Utilvo Studio100% Client-Side Suite
Markdown AST Renderer

Markdown to PDF Converter — Render .MD Files to Clean PDF

Convert Markdown (.md) files and README docs into styled PDF documents online for free. Preserve GFM tables, code blocks, and headings in your browser.

document.md
Editor
HTML Live Preview
How Markdown to PDF Works

Convert Markdown into PDF in 3 simple steps

The CommonMark compiler runs entirely in your browser — your README never touches a server.

STEP 1

Upload or Paste Markdown

Drop one or many .md files, or paste Markdown directly into the editor. Source stays in browser memory only.

STEP 2

Verify and Arrange

Preview headings, code blocks, tables, and lists live. Add more files, reorder, or clear before exporting.

STEP 3

Download PDF Document

Click Export and download a print-ready PDF with live text, code highlighting, and an auto-built TOC.

Document Compiler Architecture

Instant In-Browser Markdown Rendering vs. Cloud Converters

How Utilvo's in-browser CommonMark+GFM compiler compares to cloud MD converters that LaTeX-roundtrip your README, break Mermaid diagrams, and lose code syntax color.

Markdown to PDF Compiler Comparison
Compiler CapabilityUtilvo In-BrowserServer-Side Cloud Markdown
AST Compiler PassCommonMark tokenizer + GFM extension pass in JS, then block-by-block PDF text operatorsLaTeX roundtrip through Pandoc, fonts and code color often lost
Code Block Syntax HighlightPrism tokenization in browser, GitHub Light theme baked into PDF text spansCode rendered as monospace black, keyword colors dropped
Mermaid & Diagram FencesMermaid compiled to SVG, rasterized at 2x DPI as embedded XObjectMermaid fences emitted as raw text or broken placeholders
Table of ContentsAuto-built from H1-H3, clickable PDF link annotations to heading destinationsNo auto TOC, or static LaTeX section list with no live links
Source ConfidentialityBrowser-only, no upload, no log retention, no CDN cacheMandatory upload, README files retained for analytics
Markdown Element Anatomy

How Headings, Code Blocks & GFM Tables Are Styled in PDF

Four engineering articles walking through the entire MD to PDF pipeline — from tokenizer pass to layout break and code highlighting.

1. CommonMark Tokenizer Pass

The first pass walks the source character stream and emits block-level tokens (paragraph, heading, list, blockquote, code, table, hr) and inline-level tokens (text, emphasis, strong, code-span, link, image). The token list feeds the next AST builder pass.

2. AST Builder & GFM Extensions

The token list is collapsed into an abstract syntax tree. GFM extensions add table, task list, strikethrough, and autolink nodes. Frontmatter is parsed as YAML and attached to the document root for title, author, and date metadata.

3. Code Block Syntax Highlighting

Fenced code blocks are tokenized through Prism with the language tag from the fence info string. Tokens are color-mapped to the GitHub Light theme, then written to the PDF content stream as styled Tj text spans with monospace font subsets.

4. Page Break & Layout Engine

A virtualized layout pass measures each AST node, breaks at heading level 1 by default, honors custom :::page-break::: directives, and writes the page in PDF user space with a 1-inch margin. Page numbers are added as a footer on every body page.

Markdown Element Coverage Matrix

Markdown Element Variants Embedded in the Utilvo Pipeline

A side-by-side map of every CommonMark and GFM element type Utilvo's compiler handles, plus how each is rendered into the final PDF.

Headings

H1 to H6 with Auto Bookmark

All six heading levels are recognized. Each heading is rendered with a size-graded font weight and inserted into the PDF outline tree as a named bookmark, so the reader's sidebar navigation jumps to the section in one click.

Code

Fenced & Indented with Syntax

Triple-backtick fenced blocks and four-space indented blocks are both supported. The language tag drives Prism tokenization for keywords, strings, comments, and numbers. Output is selectable text, not an image — the code stays copyable.

Tables

GFM Pipe Tables & Alignment

Pipe syntax tables become real PDF table objects with header row striping. Colon alignment markers (:---, :---:, ---:) drive left, center, and right cell alignment. Column widths are computed from the longest cell in each column.

Lists & Tasks

Nested, Ordered & GFM Task Boxes

Ordered, unordered, and nested lists are measured for hanging indents. GFM task list items render with checked or unchecked Unicode boxes in the PDF, matching GitHub's display so your project READMEs look identical in print.

Cross-Format Comparison

Markdown vs DOCX vs ODT vs HTML vs RTF vs TXT vs PDF — Side-by-Side

How the lightweight Markdown markup compares against word-processor formats and ISO 32000-2 for technical documentation.

Cross-Format Comparison: Markdown vs DOCX vs ODT vs HTML vs RTF vs TXT vs PDF
CapabilityMarkdownDOCXODTHTMLRTFTXTPDF
FormatPlain text + symbolsOOXML (ZIP+XML)ODF (ZIP+XML)HTML / XMLRich Text FormatPlain text onlyISO 32000-2 binary
Human Readable SourceYesNo (binary)No (binary)YesYesYesNo (binary)
Version Control (Git)Excellent (diffs)PoorPoorOKOKExcellentPoor
Print-Ready LayoutRequires rendererYesYesRequires CSS printYesNoYes (native)
Best ForREADMEs, docs, blogsBusiness documentsOpen-source officeWeb pages, emailCross-platform textPlain notes, logsFinal distribution
Frequently Asked Questions

Markdown to PDF Documentation Export Questions, Answered

In-depth answers on the CommonMark and GFM parsing model, syntax-highlighted code blocks, Mermaid diagram rasterization, table-of-contents generation, embedded image base64 handling, and the page-size strategies Utilvo uses to keep documentation crisp on print-ready sheets.

Q1.Which Markdown flavors does the converter support — CommonMark, GFM, MultiMarkdown?

All three. Utilvo uses a CommonMark-compliant parser with GFM extensions for tables, task lists, strikethrough, and autolinks. MultiMarkdown metadata blocks, footnotes, and definition lists are recognized and rendered to the same PDF layout.

Q2.Will converting Markdown to PDF preserve syntax-highlighted code blocks?

Yes. Utilvo runs the code through a Prism tokenization pass in the browser, then renders the tokenized spans with the GitHub Light theme. Keywords, strings, comments, and numbers keep their distinct colors on the printed PDF page.

Q3.Can I combine multiple Markdown files into a single multi-page PDF?

Yes. Drag and drop every .md file you want, reorder the cards, then click convert. Each file becomes a chapter in the final PDF, with a top-level heading break between files and a unified page-number footer.

Q4.How are Mermaid diagrams in fenced code blocks handled?

Mermaid blocks are detected by language tag, then compiled to SVG in the browser and rasterized at 2x DPI for print sharpness. The resulting image is embedded as a PDF XObject on its own line, centered with a thin border.

Q5.Does the converter auto-generate a table of contents from headings?

Yes. Heading levels 1-3 are scanned during the Markdown parse, then a clickable TOC is prepended to the PDF. Page numbers are computed during layout and rendered as PDF link annotations pointing to the destination heading.

Q6.What about tables — GitHub pipe syntax and CSV-style alignment?

Both. GFM pipe tables become a real PDF table with proper column widths, computed from the longest cell. Colon-aligned columns (left, right, center) are honored and applied as text-alignment on the cell content.

Q7.Are confidential internal docs and README files kept private?

Yes. The whole pipeline runs inside the browser sandbox using client-side JavaScript. Your Markdown files are never uploaded to a remote server, never logged, and never cached on a CDN. Source files stay on your device.

Q8.Will the page size use A4, US Letter, or auto-fit content?

You choose. Auto-fit sizes the PDF page to a comfortable reading width (640 points by default). A4 and US Letter are also available with standard 1-inch margins. Page breaks are inserted at heading level 1 to start every chapter on a fresh page.

Q9.Is the text inside a Markdown-based PDF searchable and copyable?

Yes. Markdown text becomes real PDF text operators with embedded font subsets, so every word is selectable, copyable, and accessible to screen readers. Code blocks remain as styled text spans, not as images.

Q10.How does Utilvo handle very long README files with hundreds of headings?

The Markdown is parsed in a streaming fashion, one block at a time, so memory usage stays under 100 MB even for 500 KB documents with thousands of internal links. The PDF is built incrementally with a virtualized layout pass.

Q11.Can I add custom CSS styling — fonts, colors, code themes — before conversion?

Yes. Utilvo exposes a CSS panel where you can override font family, heading colors, code theme, table stripes, and page margins. The custom styles are applied to the rendered HTML before the PDF is generated, with no server round-trip.