Skip to main content

Markdown to HTML/PDF document converter

Project description

mddoco

A CLI tool that converts markdown files to a single HTML (or future PDF) document.

Installation

pip install mddoco
playwright install chromium

Or for development:

pip install -e .
playwright install chromium

Playwright (Chromium) is required for PDF output only. HTML output works without it.

Usage

mddoco [OPTIONS] INPUT_PATH

INPUT_PATH can be a directory (all *.md files are found recursively and sorted) or a single .md file.

Options

Option Short Default Description
--output PATH -o . Directory to write the output file
--format [html|pdf] -f html Output format
--title TEXT -t (none) Document title shown at the top of the page
--theme NAME default Theme to use for rendering
--toc / --no-toc off Generate a table of contents
--toc-depth N 3 Maximum heading depth included in the TOC (1–6)

Examples

Convert all markdown files in a directory:

mddoco ./docs

Convert a single file:

mddoco README.md

With a title, TOC, and custom output directory:

mddoco ./docs --title "My Project" --toc --output ./out

Output

All matched markdown files are combined into a single HTML document in the output directory. The filename is derived from the input folder or file name.

Themes

Themes are self-contained Jinja2 HTML files with embedded CSS. Pass a theme name with --theme NAME.

Theme Description
default Clean GitHub-style layout, 860 px centred column
default-wide Same as default but full viewport width
professional Corporate blue palette, dark title banner, card layout, 900 px centred
professional-wide Same as professional but full viewport width
dark Dark background, blue accent, light text — good for technical docs, 860 px centred
dark-wide Same as dark but full viewport width
academic Serif (Georgia) typography, justified text, print-optimised, 720 px centred
academic-wide Same as academic but full viewport width

All themes support:

  • Optional document title
  • Optional table of contents
  • Mermaid.js diagram support (loaded only when diagrams are present)
  • Graph diagram blocks

Graph diagrams

Use ```graph fenced blocks with a JSON payload. The only required field is data.

Minimal example — all defaults applied:

```graph
{
  "data": {
    "x": ["Jan", "Feb", "Mar"],
    "Sales": [100, 150, 120]
  }
}
```

Series are inferred from the data keys (everything except x). Each series defaults to a line chart in blue.

Full schema:

Field Required Default Description
data.x yes Category labels
data.<name> yes Values for each series (one key per series)
title no (none) Chart title
orientation no vertical vertical or horizontal
show_legend no true Show the legend
width_px no 640 Width in pixels
height_px no 480 Height in pixels
min / max no Axis bounds
series no (auto) Override series definitions (see below)

Series fields (all optional when auto-generated):

Field Default Description
label (data key) Must match a key in data
type line bar, line (solid), or line2 (dotted)
colour (palette) Colour string, or list of colours per bar
marker false Show point markers (line types only)

Full example:

```graph
{
  "title": "Sales vs Target",
  "orientation": "vertical",
  "show_legend": true,
  "data": {
    "x": ["Jan", "Feb", "Mar", "Apr", "May"],
    "Sales":  [85, 92, 78, 96, 110],
    "Target": [90, 90, 90, 90, 90]
  },
  "series": [
    { "label": "Sales",  "type": "bar",  "colour": "#3498db" },
    { "label": "Target", "type": "line", "colour": "#e74c3c", "marker": false }
  ]
}
```

Mermaid diagrams

Use standard fenced code blocks in your markdown:

```mermaid
graph TD
    A[Start] --> B[End]
```

mddoco detects mermaid blocks automatically and loads the Mermaid.js CDN only when needed.

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

mddoco-0.1.3.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

mddoco-0.1.3-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file mddoco-0.1.3.tar.gz.

File metadata

  • Download URL: mddoco-0.1.3.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mddoco-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b570d9865ec699dd16470b481c0e2ed66341f16e14360fdd094b49a629e16cd1
MD5 e1688e3ba0443e204fa1ec4be81032d6
BLAKE2b-256 36afe713704061d1a46a785be1bff70a9ef5545e8b4dc691adbda6e3d94ac6ff

See more details on using hashes here.

File details

Details for the file mddoco-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: mddoco-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mddoco-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e97df7163f72ad71475e30983cc14816539de22fa8a6f61f9dd5fa6d9935c12
MD5 3b679bf088e90496e7d0cbecefbada1d
BLAKE2b-256 dc29750071ff6704420bf6c86a7925dcb41ee5c558edef399c10655dc87dde1e

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