Skip to main content

Turn markdown into beautiful research blog posts

Project description

The Library of Babbl

Turn markdown into beautiful research blog posts.

Babbl

Features

  • Custom Markdown Renderer: Built with Marko for extensible HTML formatting
  • Frontmatter Support: YAML frontmatter in markdown files
  • Table Support: Full markdown table rendering with custom styling
  • Beautiful Templates: Clean, responsive HTML output with modern styling
  • Fully Customizable CSS: Complete control over styling through CSS files
  • CLI Interface: Easy-to-use command-line tools
  • Syntax Highlighting: Code blocks with Pygments integration

Installation

pip install babbl

Quick Start

Render a single markdown file:

babbl render example.md

Build multiple files in a directory:

babbl build ./docs --output-dir ./public

Render with custom CSS file:

babbl render example.md --css my-styles.css

Usage

Python API

from babbl import HTMLRenderer, BabblParser
from pathlib import Path

# Initialize parser and renderer
parser = BabblParser()
renderer = HTMLRenderer()

# Render a markdown file
with open("example.md", "r") as f:
    content = f.read()
document = parser.parse(content)
html = renderer.html(document, metadata={})
print(f"Generated HTML: {html}")

Frontmatter Support

Babbl supports YAML frontmatter in markdown files:

---
title: "My Research Paper"
author: "Dr. Jane Smith"
date: "2024-01-15"
description: "A groundbreaking study"
---

# Content here...

Table Support

Babbl includes full support for markdown tables:

| Component | Memory (MB) | Percentage |
|-----------|-------------|------------|
| Renderer Core | 2.1 | 50% |
| Frontmatter Processor | 0.9 | 22% |
| HTML Formatter | 1.2 | 28% |

Tables are automatically styled with clean, responsive CSS and support proper header formatting.

CSS Customization

Babbl provides complete control over styling through CSS files:

Customize your styles:

/* my-styles.css */
body {
    font-family: "Georgia", serif;
    background-color: #f5f5f5;
    color: #333;
}

.heading-1 {
    color: #2c3e50;
    font-size: 2.5rem;
    border-bottom: 2px solid #3498db;
}

.code-block {
    background: #2c3e50;
    color: #ecf0f1;
    border-radius: 8px;
}

Use your custom styles:

babbl render example.md --css my-styles.css

The CSS system supports all standard CSS properties for:

  • Body and section styling
  • All heading levels (h1-h6)
  • Paragraphs and text
  • Code blocks and inline code
  • Links and images
  • Lists and blockquotes
  • Emphasis (bold/italic)
  • Responsive design
  • Syntax highlighting

Table of Contents

Babbl can automatically generate a table of contents for documents with h1 headings:

# Generate HTML with table of contents
babbl render example.md --toc

The table of contents:

  • Appears as a sidebar on the left side of the content
  • Lists all h1 headings with clickable links
  • Is responsive and collapses on mobile devices
  • Uses clean, modern styling that matches the document theme
  • Provides smooth scrolling to section anchors

Python API usage:

from babbl import HTMLRenderer, BabblParser

parser = BabblParser()
renderer = HTMLRenderer(show_toc=True)  # Enable table of contents

document = parser.parse(content)
html = renderer.html(document, metadata={})

CLI Commands

babbl render <file>

Render a single markdown file to HTML.

Options:

  • --output, -o: Specify output file path
  • --css: Path to CSS file
  • --toc: Generate table of contents for h1 headings

babbl build <directory>

Build multiple markdown files in a directory.

Options:

  • --output-dir, -o: Output directory
  • --pattern: File pattern to match (default: *.md)
  • --recursive, -r: Process subdirectories
  • --css: Path to CSS file
  • --toc: Generate table of contents for h1 headings

Supported Markdown Features

  • Headings: # ## ### etc.
  • Code blocks: ```python with syntax highlighting
  • Inline code: code
  • Links: [text](url)
  • Images: ![alt](src)
  • Lists: Ordered and unordered
  • Blockquotes: > quote
  • Emphasis: bold and italic
  • Tables: Full markdown table support
  • Paragraphs: Automatic wrapping

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

babbl-0.2.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

babbl-0.2.2-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file babbl-0.2.2.tar.gz.

File metadata

  • Download URL: babbl-0.2.2.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for babbl-0.2.2.tar.gz
Algorithm Hash digest
SHA256 df171e3b346952f45b45a4a1e62df53f3f68c18f9999c7255982caf9a58ec579
MD5 4049a4382d01d7bbde865458cdc229c5
BLAKE2b-256 b2f5591b76d90896c9ea1d1eb9f197d33ff0989c4a23a8798c3c9d7c5d68850d

See more details on using hashes here.

File details

Details for the file babbl-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: babbl-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for babbl-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 75b6e3f0e9c808a664cc11fabc4de8568cab1e3cc03bf5d7524c836ca8f42972
MD5 3f9e4f4221e22e17ef7e986521451d7c
BLAKE2b-256 580a421fd2857f059720c758eba56418c195e8fcf84f7adebfae078351c14cd9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page