Merge Markdown files into a single PDF or HTML presentation with Pandoc + XeLaTeX
Project description
mdfusion
Merge all Markdown files in a directory tree into a single PDF or HTML presentation with formatting via Pandoc + XeLaTeX.
Features
- Recursively collects and sorts all
.mdfiles under a directory (natural sort order) - Merges them into one document, rewriting image links to absolute paths (so images with the same name in different folders don't collide)
- Optionally adds a title page with configurable title, author, and date
- Supports both PDF (via Pandoc + XeLaTeX) and HTML presentations (via reveal.js)
- Customizes output with your own LaTeX or HTML headers/footers
- Configurable via TOML for repeatable builds (great for books, reports, or slides)
- Bundles HTML presentations with all assets for easy sharing
Installation
Requirements
You must have the following on your PATH:
For HTML presentations and PDF export from HTML, you may also want to install:
- Playwright (for HTML→PDF conversion) via
pip install playwrightand thenplaywright install
Install via pip
pip install mdfusion
Install from source
git clone https://github.com/ejuet/mdfusion.git
cd mdfusion
pip install .
Usage
mdfusion ROOT_DIR [OPTIONS]
Common options
-o, --output FILEOutput filename (default:<root_dir>.pdfor.htmlfor presentations)--no-tocOmit table of contents--title-pageInclude a title page (PDF only)--title TITLESet title for title page (default: directory name)--author AUTHORSet author for title page (default: OS user)--pandoc-args ARGSExtra Pandoc arguments (whitespace-separated)-c, --config FILEPath to amdfusion.tomlconfig file (default:mdfusion.tomlin the current directory)--presentationOutput as a reveal.js HTML presentation (not PDF)--footer-text TEXTCustom footer for presentations
Example: Merge docs/ into a PDF with a title page
mdfusion --title-page --title "My Book" --author "Jane Doe" docs/
Example: Create a reveal.js HTML presentation
mdfusion --presentation --title "My Talk" --author "Speaker" --footer-text "My Conference 2025" slides/
Configuration file
You can create a mdfusion.toml file in your project directory to avoid long command lines. The [mdfusion] section supports all the same options as the CLI.
Example: Normal document (PDF)
[mdfusion]
root_dir = "docs"
output = "my-book.pdf"
no_toc = false
title_page = true
title = "My Book"
author = "Jane Doe"
pandoc_args = ["--number-sections", "--slide-level", "2"]
# header_tex = "header.tex" # Optional: custom LaTeX header
Example: Presentation (HTML via reveal.js)
[mdfusion]
root_dir = "slides"
output = "my-presentation.html"
title = "My Talk"
author = "Speaker"
presentation = true
footer_text = "My Conference 2025"
pandoc_args = ["--slide-level", "6", "--number-sections", "-V", "transition=fade", "-c", "custom.css"]
# You can add more reveal.js or pandoc options as needed with ["-V", "option=value"]
Then just run:
mdfusion
How it works
- Finds and sorts all Markdown files under the root directory (natural order)
- Merges them into one file, rewriting image links to absolute paths
- Optionally adds a YAML metadata block for title/author/date
- Calls Pandoc with XeLaTeX (for PDF) or reveal.js (for HTML presentations)
- Optionally bundles HTML output with all assets for easy sharing
Testing
Run all tests with:
pytest
Author
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mdfusion-0.2.2.tar.gz.
File metadata
- Download URL: mdfusion-0.2.2.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd40ab72f7d0f0fdff2c422f54c4bad3996b2a0ed1931ae4eadd07eafc4487ab
|
|
| MD5 |
845752a93be9c76015d3fa7c291622ed
|
|
| BLAKE2b-256 |
168204b9a589989d9d1e73d09ed5cf68970d8dc1baa9b4de82c37bf7b7ef1f3e
|
File details
Details for the file mdfusion-0.2.2-py3-none-any.whl.
File metadata
- Download URL: mdfusion-0.2.2-py3-none-any.whl
- Upload date:
- Size: 27.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91f8a107b5b5f0ec3457d8a1ac37a38cbe99b79848a90d55fef84f469c6c66e2
|
|
| MD5 |
5fd78b8a7555906316d846ce13ad33a7
|
|
| BLAKE2b-256 |
c5ce034efcf1ccd12f336539ab5fa0e5e95baf4b67304df6cc348b6fdd28ffd0
|