-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Leafmark turns a folder of Markdown files into a polished PDF, DOCX, HTML document, or a combination of outputs. It is powered by Pandoc and adds project organization, metadata, themes, citations, fonts, reusable filters, HTML/CSS rendering, watch mode, and a VS Code interface.
pnpx @skxv/leafmark init ./my-report
cd my-report
pnpx @skxv/leafmarkThe generated document is written to dist/my-report.pdf.
- Getting Started — install the required tools and build a first document.
- Project Structure — understand chapters, configuration, assets, and output.
- CLI Reference — every command and option.
-
Configuration —
.leafmark/config.jsonreference and precedence rules. - Frontmatter Reference — titles, authors, layout, citations, and PDF metadata.
- HTML and CSS — use styled HTML in Markdown and render it into every format.
- Themes — apply, build, and publish document themes.
- Troubleshooting — diagnose the most common build failures.
| Output | Command | Notes |
|---|---|---|
pnpx @skxv/leafmark |
Default output; uses XeLaTeX when available. | |
| DOCX | pnpx @skxv/leafmark --output-format docx |
A Word-compatible document. |
| HTML | pnpx @skxv/leafmark --html-only |
Standalone HTML with embedded resources. |
| PDF + HTML | pnpx @skxv/leafmark --html |
Produces both in one build. |
- Each ordinary
.mdfile in the project root is a chapter. -
.leafmark/config.jsonstores project behavior, chapter order, themes, and extensions. -
_frontmatter.mdoptionally stores human-friendly YAML metadata. - Leafmark merges the chapters and asks Pandoc to produce the selected outputs.
- Themes and project settings control the appearance without changing chapter content.
Leafmark also recognizes nested Bundles and Chapter Ordering, supports Pandoc citations, accepts custom Lua filters, and exposes JSON Lines events for editor and automation integrations.
Tip
Run pnpx @skxv/leafmark doctor whenever a machine is newly configured or a PDF build reports a missing external tool.
- Node.js 20 or newer
- Pandoc
- XeLaTeX or pdfLaTeX for PDF output
-
pdfuniteonly when merging a cover PDF - Git only when installing a theme from GitHub
- Chrome, Chromium, Edge, or Brave only when PDF or DOCX output contains HTML blocks
See Installation for platform-specific commands.
Leafmark documentation · Source repository · npm
Leafmark Wiki
Authoring
Configuration
Building
Help