md2pdf converts Markdown into structured PDF files using Pandoc, LaTeX templates, and a curated Lua filter pipeline.
Runtime requirements:
- Pandoc with Lua support
- A LaTeX distribution with
pdflatex pandoc-includepandoc-crossref- Python 3 (required for
--asset-link)
Installation from this repository also requires make and the standard install utility.
Install the Python-based Pandoc include filter with pipx:
pipx install pandoc-includeCheck that the required Pandoc filters are visible on PATH:
command -v pandoc-include pandoc-crossrefInstall from this repository:
make installUser-local install:
make PREFIX=$HOME/.local installConvert a Markdown file:
md2pdf -- note.mdSelect a template:
md2pdf --template article-modern -- note.mdRun directly from source tree:
./src/app/md2pdf.sh -- doc/exp/main.mdSee doc/exp for runnable examples, including filters, assets, tables, and source includes.
doc/exp/inline-code.md demonstrates inline code with German umlauts and code
punctuation, including code beginning with an umlaut. All bundled templates
preserve äöüÄÖÜß in inline code with the default Listings backend.
md2pdf [options] -- <input.md> [pandoc args...]Options:
-o, --output <file>: output PDF path (default:<input>.pdf)--template <name|path>: template name or explicit.texpath--list-templates: list available template names and exit--closure-manifest: print canonical renderer-closure identity (JSON) and exit--asset-link <dir>: create temporary asset symlink(s) in input directory--debug: print resolved paths and full Pandoc command--version: print version information
Use external assets without moving files:
md2pdf --asset-link ../shared-assets -- note.mdInspect the exact effective renderer identity (script, filter manifest, active filters in order, template, and header include, plus Pandoc/pandoc-crossref/PDF-engine versions) without rendering a PDF. Useful for downstream tooling that needs to verify two installations render identically:
md2pdf --template article-modern --closure-manifest.
|-- .ai4x
|-- acc
| `-- obsidian
|-- doc
| `-- exp
|-- src
| |-- app
| |-- lib
| | |-- filters
| | `-- templates
| `-- tst
`-- utl
`-- completions
From the repository root, run the syntax, structure, charset, golden-output, and renderer-identity checks:
make verifyThis requires the runtime tools above, Python 3, and Perl. It does not compile PDFs. To compile the inline-code regression fixture with every bundled template and check the extracted text, also run:
make verify-pdfThe PDF check additionally requires Poppler's pdftotext and a LaTeX
installation with the packages and fonts used by the bundled templates.