Export a Markdown document with a Mermaid diagram to PDF
Your Markdown document holds a Mermaid block, a table, sometimes a formula. Marko renders it on your Mac and exports it to a paginated PDF, diagram included. The job here is simple: cleanly ship a Markdown document that contains a chart.
What Marko renders
Marko stays a Markdown editor, not a diagram workshop. It renders what your document describes, including diagrams written inside a code block. When you open a file with a Mermaid block, Marko turns it into an image, in its place within the text.
On a check run against an internal corpus, every Mermaid diagram present was rendered, twenty for twenty. A DOT graph goes through the same way, as an image. GFM tables and KaTeX formulas render too, inline and as blocks.
The diagram often comes from your AI
Claude, ChatGPT or Codex will happily answer with a Mermaid block when you ask for a flow chart or a sequence. You get back text like this:
```mermaid
graph TD
A[Idea] --> B[Brief]
B --> C[Review]
C --> D[PDF export]
``` Pasted into a plain text editor, that block stays code. In Marko, you paste it in Source mode, switch to Visual mode, and the chart appears. You fix a label if needed, then export.
Prepare and export the document
- In Marko, open your .md file or create a document.
- Write or paste a Mermaid code block with your diagram, and add a table if your document has one.
- Switch to Visual mode: the diagram shows as an image, the table takes its shape.
- In the File menu, choose “Export as PDF…”, name the file and confirm.
The PDF is paginated as A4, with an “n / N” page number in the footer. The Mermaid diagram and the table appear in the exported document.
An example to try
You can download the example brief to see the export path. That brief has a table, but no Mermaid block. To test diagram rendering, open one of your own documents that has one, or paste into the brief the block your AI returned before you export.
One document, several kinds of blocks
A spec often pulls together a flow chart, a table of owners and a formula. Marko renders all three in the same document: the Mermaid diagram as an image, the GFM table, the KaTeX formula inline or as a block. The export carries the whole thing across the same pages, with no need to pull each piece out on its own.
The rendering and the export happen on your Mac. The file is not sent to a service to produce the diagram image or the PDF.
What the PDF keeps
| Document element | In the PDF |
|---|---|
| Mermaid diagram | Rendered as an image |
| DOT graph | Rendered as an image |
| GFM tables | Rendered; across pages, the header repeats at the top of each page |
| KaTeX formulas | Rendered inline and as blocks |
The limits to know
Worth knowing before you rely on export for a large document or for accessibility.
- Marko runs on Mac Apple Silicon, macOS 12 or later. Mac Intel, Windows and Linux builds are not distributed yet.
- The PDF is not tagged: it suits reading and printing, not a screen reader that relies on tagged structure.
- Very large documents are capped, on the order of a few thousand blocks, to avoid an endless layout.
If you mostly need to keep the source, Marko writes plain Markdown, Mermaid block included, which your colleagues reopen in the editor of their choice. The full trial runs for fourteen days, with no account and no card.
Frequently asked questions
Is Marko a diagram editor?
No. Marko stays a Markdown editor. It renders a Mermaid diagram written in the document and includes it in the PDF, but it is not a standalone diagram workshop.
Does the example brief contain a Mermaid block?
No. The example brief has a table, but no Mermaid block. To test diagram rendering, paste in the block your AI returned, or open one of your own documents that has one.
Does the diagram go to a service to be rendered?
No. The rendering and the export happen on your Mac. The file is not sent to a service to produce the diagram image or the PDF.
Do a table and a formula also go into the PDF?
Yes. The Mermaid diagram becomes an image; the GFM table and the KaTeX formula are rendered too, and the export carries the whole thing.
Try it on your own file. Open a .md your AI just wrote, fix it and export it. Marko runs on Apple Silicon Macs, macOS 12 or later.
Full 14-day trial, no account or credit card. See pricing