Skip to content

Markdown support

Pardown supports the Markdown elements used by its current renderer and preserves readable content when it encounters an unsupported element. Use this reference to check which formatting appears in the generated PDF.

Supported block elements

Pardown applies dedicated PDF formatting to these block elements:

  • Paragraphs
  • Level 1, 2, and 3 headings
  • Ordered and unordered lists, including nested lists
  • Fenced code blocks with syntax highlighting
  • Horizontal rules
  • Images

A single newline inside a paragraph or list item creates a visible line break. This differs from Markdown implementations that combine consecutive source lines into one line.

md
First line
Second line

The example renders on two lines.

Supported inline elements

Pardown applies dedicated formatting or metadata to these inline elements:

  • Bold text with **bold**
  • Italic text with *italic*
  • Strikethrough text with ~~strikethrough~~
  • Inline code with `const total = 4`
  • Links with [Comark](https://comark.dev)
  • Explicit line breaks

Links are underlined and retain their destination in the generated PDF. Inline code uses the Courier font.

Code blocks

Add a language after the opening fence to apply syntax highlighting. Pardown uses Rangi's GitHub light theme for highlighted code.

md
```ts
const invoiceTotal = 42;
console.log(invoiceTotal);
```

Code blocks without a recognised language still render as preformatted text.

Images

Use standard Markdown image syntax for local or remote images. Always provide useful alternative text because Pardown displays it when an image can't be loaded.

md
![Weekly sales by region](charts/weekly-sales.png)

![Weather radar](https://assets.example.com/weather/radar.png)

Pardown renders loaded images at the available content width. Read Image loading and cancellation for file resolution and custom loaders.

Unsupported elements

Pardown doesn't currently apply dedicated formatting to these common elements:

  • Level 4, 5, and 6 headings
  • Blockquotes
  • Tables
  • Task-list checkboxes
  • Other HTML or Comark nodes that aren't listed as supported

For each unsupported node, Pardown emits an UNSUPPORTED_NODE diagnostic, removes the unsupported wrapper, and continues to render supported descendants. For example, the text inside a blockquote remains visible without blockquote styling. Complex structures such as tables can lose their layout.

WARNING

Don't rely on the fallback renderer to preserve document structure. Replace unsupported elements with supported Markdown when layout matters.

Raw HTML

Comark can parse raw HTML into its simple tuple-based abstract syntax tree, but Pardown only maps a small element set. Prefer Markdown syntax because unsupported HTML elements produce diagnostics and lose their element-specific formatting.

The renderer recognises p, h1, h2, h3, ul, ol, li, pre, hr, strong, em, del, code, a, span, br, and img. For span, only an inline color declaration affects rendering; other CSS declarations are ignored.

Lists

Ordered lists always start at 1, regardless of the number used in the Markdown source. Each nested ordered list starts a new counter.

md
7. Discovery
8. Design
9. Delivery

The generated PDF labels these items 1, 2, and 3.

Next steps

Use these pages to continue working with Pardown:

Released under the MIT License.