Getting started
Introduction
What comark-pdf is, how it fits with Comark and jasy, and when to use it for print-ready PDF output.
comark-pdf is the PDF renderer for Comark. It converts Comark Markdown to print-ready PDF bytes through jasy — no headless browser required.
How it works
Three layers, one job each:
| Layer | Job |
|---|---|
| Comark | Parse markdown to an AST. |
comark-pdf | Read that AST. Choose policy. Call jasy primitives. |
| jasy | Draw and lay out PDF primitives. It does not parse Markdown, Mermaid, KaTeX, or Shiki. |
Merge order for page config (last write wins): frontmatter.pdf → options.pdf.
What you get
- One-shot or reusable renderers —
renderPdf()orcreatePdfRenderer()with a parser initialized once - Node helpers —
renderPdfToBufferandrenderPdfToFilefromcomark-pdf/node - Browser preview — mount bytes with
comark-pdf/preview - Host options — page size, margins, chrome, fonts, visuals, plugins, components, and binding data
- Feature matrix — see Syntax matrix for what Comark syntax maps to PDF
comark is a peer dependency. Install it in your app alongside comark-pdf.