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.1.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.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: babbl-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 85ed964498b0a2aa5f9543487adad9f9cdda8b4c03bee0c9337d307b55438c24
MD5 12f786ad5e0df41ebcd87e2b0dc32a34
BLAKE2b-256 6a30f778366da1397f23d3f954c513c1b963fdd973dbe5320773efa3a4c96b32

See more details on using hashes here.

File details

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

File metadata

  • Download URL: babbl-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a1d877fdf4ba59fe50278bc2a33be72d74af91cb7a1038aeb423e1aeaff5e4f3
MD5 102c98659aa4cff068ac606386074654
BLAKE2b-256 88343a5c826784632b2f5a87a36a861f98501200a4cb45f222a13791ae0df4b6

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