Skip to content
normenmuellerPublic

About

Flavored Markdown to PDF converter

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

30 Commits

Folders and files

Repository files navigation

md2pdf

md2pdf converts Markdown into structured PDF files using Pandoc, LaTeX templates, and a curated Lua filter pipeline.

Install

Runtime requirements:

  • Pandoc with Lua support
  • A LaTeX distribution with pdflatex
  • pandoc-include
  • pandoc-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-include

Check that the required Pandoc filters are visible on PATH:

command -v pandoc-include pandoc-crossref

Install from this repository:

make install

User-local install:

make PREFIX=$HOME/.local install

Quick Start

Convert a Markdown file:

md2pdf -- note.md

Select a template:

md2pdf --template article-modern -- note.md

Run directly from source tree:

./src/app/md2pdf.sh -- doc/exp/main.md

See 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.

Usage

md2pdf [options] -- <input.md> [pandoc args...]

Options:

  • -o, --output <file>: output PDF path (default: <input>.pdf)
  • --template <name|path>: template name or explicit .tex path
  • --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.md

Inspect 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

Project Structure

.
|-- .ai4x
|-- acc
|   `-- obsidian
|-- doc
|   `-- exp
|-- src
|   |-- app
|   |-- lib
|   |   |-- filters
|   |   `-- templates
|   `-- tst
`-- utl
    `-- completions

Verification

From the repository root, run the syntax, structure, charset, golden-output, and renderer-identity checks:

make verify

This 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-pdf

The PDF check additionally requires Poppler's pdftotext and a LaTeX installation with the packages and fonts used by the bundled templates.

License

See LICENSE. © 2026 nemron

About

Flavored Markdown to PDF converter

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages