Guide

Plugins

Register math and Mermaid parser plugins and map their component tags for PDF output.

Pass Comark parser plugins through PdfRendererOptions.plugins. Register matching component factories when the plugin emits component nodes.

import { renderPdf } from 'comark-pdf'
import math, { Math } from 'comark-pdf/plugins/math'
import mermaid, { Mermaid } from 'comark-pdf/plugins/mermaid'

const bytes = await renderPdf(markdown, {
  plugins: [math(), mermaid()],
  components: { Math, Mermaid },
})

Math

With mathjax-full installed, $…$ and $$…$$ render as SVG. Without it, the source appears in Courier.

Mermaid

With mermaid (and optionally DOM / happy-dom), fenced mermaid blocks render as SVG. Otherwise the source appears in a monospace box.

Binding

The binding plugin powers {{ }}, :attr, ::if, ::for, and ::include. Pass data (and each for batches) in renderer options.

See the syntax matrix for how each feature maps to jasy.

Copyright © 2026