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.5.tar.gz (19.9 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.5-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: babbl-0.2.5.tar.gz
  • Upload date:
  • Size: 19.9 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.5.tar.gz
Algorithm Hash digest
SHA256 7548e19fd20f7fc412b149e4b081a32b0208779d58fceecbdf1b62428c55f4bb
MD5 762449ffa0f4d0d41c0f6b1022bf4e30
BLAKE2b-256 ac72ab0c73d9e2aa43a36f725b67d8360f8ac398c3b616baed7c265157cc9a8f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: babbl-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 20.2 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d4db61f2c54bd711facf41b76548f97277cad94d30a12b3cd43a522b78d73fff
MD5 a60031ded444c06a88d1b00292f3d777
BLAKE2b-256 ffa255a606c8b138633410af8288011d06fd038b53dc1125063f96fb7b40d53d

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