Markdown cheat sheet PDF: syntax to print

Use a Markdown cheat sheet PDF as a fixed reference, and keep its editable source beside it. The useful checks fall into three groups: core syntax, optional extensions, and print layout. Label those groups separately so a missing checkbox does not send you looking for a different paper size.

Download the printable PDF 8 and keep the editable Markdown source 9. The sheet puts copyable punctuation beside its purpose, separates extension-dependent examples, and includes a code-fence example you can reuse. Our local renderers agreed on the core sample but differed on extension support and fence closure. 7

Classify the problem with your Markdown cheat sheet PDF

Match the symptom to the stage before changing the sheet. A heading that never becomes a heading, a task marker that stays as text, and a table cut off on paper need different repairs.

Feature or symptom How to recognize the case Route
Core syntax or literal examples A heading remains ordinary text, or a code example consumes following prose Inspect marker spacing and code-fence boundaries
Optional extensions Core formatting works, but table pipes, task markers, or deletion marks remain literal Select support for the particular extension
Print layout The HTML contains the intended content, but the PDF clips or splits it Change the page layout after rendering

The check is the intermediate HTML. Find the heading, table, or code block you expected there. If its structure is absent, changing margins cannot add it. If the structure and text are present, paper width and wrapping become relevant.

Keep the core syntax copyable

Keep the copyable punctuation visible in a reference. Code spans preserve the markers in these short examples, while the result column explains what they request. These patterns belong to the core syntax covered by CommonMark. 1

Purpose Source to copy Intended result
Heading # Heading A heading, with a space after the marker
Emphasis *italic* Emphasized text
Strong emphasis **bold** Strongly emphasized text
Inline code `value` Literal text in code style
Link [label](https://example.com) A link with a visible label
List item - Draft A bullet item
Paragraph Leave a blank line A separate paragraph

Use the source column when editing and the result column when reading. Copying only a rendered heading loses the marker that identifies it as a heading.

Our core sample contains a heading, emphasis, a short list, and a link. All the local paths produced those structures on that input. The shared result does not establish that their entire grammars match. 7

Output from our core-syntax sample, unedited:

<h1>Reference</h1>
        <p>Use <strong>bold</strong> and <em>italic</em>.</p>
        <ul>
        <li>Draft</li>
        <li>Review</li>
        </ul>
        

That HTML came from markdown-it-py in CommonMark mode. The words inside the heading and list survive as text within the corresponding elements.

Choose extensions feature by feature

Choose extension support feature by feature. A pipe table, a task list, and strikethrough are separate additions in the GFM specification. Enabling a table extension alone does not select the whole set. 23

Local path used here Table sample Task markers Strikethrough
markdown-it-py, CommonMark mode Pipes remain text Brackets remain text Tildes remain text
Python-Markdown, tables and fenced-code extensions Table generated Brackets remain text Tildes remain text
Pandoc, GFM reader Table generated Checkbox elements generated Deletion element generated

Python-Markdown renders the table while its task markers remain visible. 7

Output from our extension sample, unedited:

<ul>
        <li>[x] Draft ready</li>
        <li>[ ] Review pending</li>
        </ul>
        

This is the end of the Python-Markdown output, after the generated table. The bracketed marks remain part of the list text. Pandoc's GFM path instead produces checkbox elements on that same input. 7

Output from our extension sample, unedited:

<ul class="task-list">
        <li><label><input type="checkbox" checked="" />Draft ready</label></li>
        <li><label><input type="checkbox" />Review pending</label></li>
        </ul>
        

A checkbox element in local HTML does not establish that a hosted editor provides an interactive task workflow. For a printable sheet, it establishes the narrower fact that the selected reader recognized the task syntax.

Failure condition Visible result What to change
A table-capable reader is not selected The delimiter row and pipes stay in the text Enable table parsing
Only table support is selected Tables render but task brackets or deletion marks remain Add the missing extension or retain plain labels
A table cell teaches a literal pipe The reference row breaks into unintended cells Escape that pipe, including inside a code span in a GFM table

The GFM table rules require a literal pipe inside a cell to be escaped even when it appears inside a code span. Our printable source uses that rule so the table example stays inside its own cell. 29

Preserve the fences inside a code example

Use a longer outer fence with matching ends when displaying fenced examples. The outer wrapper tells the parser to keep the inner fence as text. It must stay open through the entire example.

Markdown input for our literal-fence check, unedited:

````markdown
        ```python
        print("hello")
        ```
        ````
        

The sample uses an outer fence of four backticks at both ends. The enclosed fence is shorter, so it stays in the displayed code. All the tested paths retained that inner example in a code block. 7

CommonMark permits a closing fence at least as long as its opening fence. Its rule therefore accepts a longer closing line. The Python-Markdown path we tested did not accept that form, even though it handled the matching wrapper above. 17

Output from our longer-closing-fence sample, unedited:

<p>```text
        literal <strong>bold</strong>
        ````</p>
        <p>After the example.</p>
        

The intended literal asterisks became bold markup. The opening fence remained paragraph text, so the source example no longer meant what it was meant to teach.

Python-Markdown's fenced-code preprocessor captures the opening fence and uses an exact backreference for the closing fence. The markdown-it-py fence rule instead skips a candidate closing line when it is shorter than the opening. 45

For a reference shared between these tested paths, use the same length at both outer ends and make that wrapper longer than any inner backtick fence. If an example needs a longer inner fence, increase the wrapper accordingly. A language label describes the example's language, but does not protect its closing boundary.

Render the content before fixing the paper

Fix missing HTML structure before adjusting paper layout. The parser establishes headings, tables, and literal code, while the PDF layout sets their width and page breaks.

Pandoc can produce a standalone HTML document with an explicit GFM reader. This command was executed against the core sample. Replace the generic input with your own reference, then use a PDF-capable layout route for the HTML. 6

pandoc --from=gfm --to=html5 --standalone --no-highlight input.md -o output.html
        

The supplied PDF uses Pandoc HTML followed by PyMuPDF Story, rather than a browser's print dialog. We inspected its rendered pages and corrected a broken table row in the source before rebuilding it. 1011

Visible failure The stage to inspect Repair
Syntax markers disappear from a teaching example Rendered HTML Display the source as code
A table is already plain text in HTML Markdown reader and extensions Select table support before printing
HTML has the content, but the paper cuts it off PDF layout Adjust margins, wrapping, or the example width
The reference must be edited later Original Markdown source Change the source and rebuild the PDF

A PDF-only reference requires a different recovery step. Markovo's PDF to Markdown converter can provide editable content from a PDF. Extraction does not establish which original Markdown markers produced the page, so inspect the recovered punctuation before using it as a syntax reference. That reverse conversion was not tested for this guide.

Keep the Markdown source as the editable copy and the PDF as the fixed visual reference. Label optional syntax beside its examples, preserve literal fences with a matched wrapper, and rebuild from the source when the sheet changes.

How we tested

The comparisons cover local HTML output and the supplied PDF, not hosted editors. We ran the following on 2026-11-02 using Python 3.11.14. The code printed inside the fence samples was literal input to Markdown parsers, not an executed Python program.

Component Version Options and role
markdown-it-py 4.0.0 MarkdownIt('commonmark'), no plugins or highlighting callback
Python-Markdown, package name Markdown 3.10.2 extensions=['tables', 'fenced_code'], no other extensions
Pandoc 3.11 --from=gfm --to=html5 --wrap=none --no-highlight for the comparison
PyMuPDF 1.28.2 Story HTML-to-PDF layout for our own reference, not a Markdown reader

The interpreter came from the existing lab environment. The script reads the already installed Markdown packages from the repository environment through an appended module search path. Neither environment was changed. 7

Source What it isolates
lab/renderers/core.md Heading, emphasis, list, and link
lab/renderers/extensions.md Table, strikethrough, and task syntax on the same input
lab/renderers/fence-safe.md Longer outer fence with matching ends
lab/renderers/fence-short.md Outer and inner fences of the same length
lab/renderers/fence-long-close.md Closing fence longer than its opening
lab/renderers/cheat-sheet.md Editable reference used to build the PDF

From the repository root, the complete commands are:

tools/lab-venv/bin/python runs/2026-11-02-markovo-markdown-cheat-sheet-pdf/lab/renderers/run.py
        tools/lab-venv/bin/python runs/2026-11-02-markovo-markdown-cheat-sheet-pdf/lab/renderers/build_pdf.py
        

The comparison script runs Pandoc through standard input with the options above. The standalone command in the article uses the same core input under a generic name, with --standalone added for a full document. Its output is saved as lab/renderers/cli-output.txt and its exact command as lab/renderers/cli-check.json.

The matrix below comes directly from lab/renderers/results.json. It counts actual HTML start tags, using Python's HTMLParser. The script also retains text inside pre elements. Counts describe structure rather than visual fidelity, accuracy, or speed. The PDF/OCR scorer is not used for this syntax experiment. 7

Sample Local renderer h1 strong table del input pre p
core markdown-it-commonmark 1 1 0 0 0 0 2
core python-markdown 1 1 0 0 0 0 2
core pandoc-gfm 1 1 0 0 0 0 2
extensions markdown-it-commonmark 0 0 0 0 0 0 1
extensions python-markdown 0 0 1 0 0 0 0
extensions pandoc-gfm 0 0 1 1 2 0 0
fence-safe markdown-it-commonmark 0 0 0 0 0 1 0
fence-safe python-markdown 0 0 0 0 0 1 0
fence-safe pandoc-gfm 0 0 0 0 0 1 0
fence-short markdown-it-commonmark 0 0 0 0 0 2 0
fence-short python-markdown 0 0 0 0 0 1 1
fence-short pandoc-gfm 0 0 0 0 0 2 0
fence-long-close markdown-it-commonmark 0 0 0 0 0 1 1
fence-long-close python-markdown 0 1 0 0 0 0 2
fence-long-close pandoc-gfm 0 0 0 0 0 1 1

The original HTML outputs are named <sample>--<renderer>.txt under lab/renderers/, using the sample and renderer names in the table. The comparison script writes every row and output. In the equal-length nested-fence case, the CommonMark and Pandoc paths produced an extra empty code block. Python-Markdown left later content in a paragraph. The longer-closing-fence case produced no code block on the Python-Markdown path, with emphasis parsed instead. 7

The PDF build script splits our reference at its explicit build-only comment, <!-- sheet-page -->. That comment is not a portable Markdown page-break instruction. Each half passes through the Pandoc command above, then through PyMuPDF Story with A4 paper and margins of 36 points left/right, 32 top, and 38 bottom. It produced 2 pages, with each half occupying a page. We rendered and viewed both pages after fixing the source table and fence display. All 8 content checks in the build record passed. Raw HTML is retained in lab/renderers/cheat-sheet-html.txt, with extracted PDF text in lab/renderers/cheat-sheet-extracted.txt. 891011

This is a small syntax and layout check, not a full conformance suite or a PDF extraction benchmark. We did not test browser printing, GitHub.com, VS Code, Jupyter, conversion services, or runtime performance. Local CommonMark mode and a local GFM reader do not establish those products' behavior. The pinned parser sources explain the fence difference independently of the output counts. 45

Sources

  1. CommonMark specification 0.31.2
  2. GitHub Flavored Markdown specification 0.29-gfm
  3. Python-Markdown Tables extension
  4. Python-Markdown 3.10.2 fenced-code source
  5. markdown-it-py 4.0.0 fence rule source
  6. Pandoc manual
  7. Local renderer options and complete structural results
  8. Printable Markdown reference PDF
  9. Editable source for the printable reference
  10. PyMuPDF Story documentation
  11. PDF build options and content checks