title: “Markdown renderer torture test” description: “CommonMark, GFM, extensions, raw HTML, math, and media” tags: [markdown, rendering, test]

draft: true

Markdown Renderer Torture Test

This document deliberately mixes CommonMark, GitHub Flavored Markdown (GFM), renderer-specific extensions, LaTeX math, and raw HTML. Unsupported syntax should remain readable as source text rather than disappearing.

Table of contents


Headings

H1: bold, italic, code, link, \(x^2\), and 😀

H2: bold italic, strike, mark, and # escaped hash

H3: bold with nested italic and const x = "#"

H4: bold linked text

H5: H2O, x2, underline
H6: code + strong + emphasis + GFM

Setext H1 with style, code, and link

Setext H2 with emphasis and HTML mark

Heading with a custom ID

The {#custom-heading-id} form is an extension and may render literally.


Inline text

Plain text. Asterisk italic. Underscore italic. Asterisk bold. Underscore bold. Bold italic. Also bold italic. GFM strikethrough. Extension subscript. ^Extension superscript^. ==Extension highlight==. ++Extension insertion++. ||Spoiler extension||.

Nested: bold and italic and struck and code. Overlapping delimiter stress: one two and one *two three*. Intraword underscores should remain: snake_case_name and foobarbaz.

Raw HTML styles: bold, strong, italic, emphasis, underline, strike, deleted, inserted, highlighted, small, H2O, x2, Ctrl+C, sample output, and variable.

Combinations: marked bold italic underlined and bold deleted with H2O and xn.

Inline code: printf("hello") and code containing a ` backtick.

Two trailing spaces create a hard break.
This line follows a hard break. A backslash also creates one.
This follows the backslash break. This single newline is normally a soft break.

HTML entities: & < > " ' © ® ™   © 🚀.

Unicode: café, naïve, Ελληνικά, Русский, 日本語, 한국어, العربية, עברית, हिन्दी, 😀 🚀 🧪. Combining characters: é versus é. RTL isolate: مرحبا بالعالم. Emoji shortcode extension: :rocket: :warning: :+1:.

Inline CSS style and custom attributes.


Links and images

Links

Inline link, link with title, relative link, fragment link, and encoded URL.

Reference link, numbered reference, collapsed reference, and shortcut-reference.

Autolinks: https://example.com/path?q=test and test@example.com. GFM autolinks: https://example.com and test@example.com.

Potential platform extensions: @octocat, #123, GH-123, and [[Wiki Link]].

Markdown images

Deterministic images use seeded picsum.photos URLs. Sizes range from tiny to large and from extreme panoramas to extreme portraits.

Tiny 16 by 16 square Icon 32 by 32 square Small 64 by 64 square Avatar 96 by 96 square Thumbnail 160 by 90, 16 to 9 Classic 200 by 150, 4 to 3 Square 256 by 256 Medium 320 by 180, 16 to 9 Portrait 240 by 320, 3 to 4 Landscape 400 by 300, 4 to 3 Photo 480 by 270, 16 to 9 Golden-ish 500 by 309 Wide 600 by 200, 3 to 1 Portrait 400 by 600, 2 to 3 Standard 640 by 480, 4 to 3 HD 800 by 450, 16 to 9 Tall 450 by 800, 9 to 16 Square 800 by 800 Cinematic 1000 by 429, 21 to 9 Large 1200 by 800, 3 to 2 Full HD 1920 by 1080, 16 to 9 Extreme panorama 1600 by 160, 10 to 1 Extreme portrait 160 by 1600, 1 to 10

Images inline: red square between words and blue rectangle at the end.

Linked 320 by 180 image

Image using a reference

A deliberately long alternative description explaining that this is a wide landscape photograph used to test wrapping, accessibility text, and rendering behavior when image loading is disabled

Unicode and encoded query test

HTML images with explicit dimensions

Rendered at width 120 Rendered at height 100 Forced to 240 by 100 Fluid responsive image Circular image Object-fit cover crop

Responsive images

Responsive 16 by 9 image with four candidates

Art-directed picture: wide on desktop, tall on mobile

Figures, loading, SVG, animation, and failure

Mountain-like landscape placeholder
Figure 1: a responsive caption with bold, italic, and a link.

Eager high-priority image

Remote SVG

Animated GIF

Intentionally broken image: alt text should appear

SVG fallback text with fallback link.


Lists

Unordered, ordered, and deeply mixed

  1. First ordered item

  2. Second ordered item

  3. Third ordered item

  4. Ordered list starting at seven

  5. Eight

  6. Nine

Tight and loose lists

Loose item one, second paragraph with style.

A blockquote nested in a list.

The fenced-code variant of this list case is in codeblockstest.md.

| Nested | Table | |:–|–:| | left | right |

Task lists

Definition lists (extension)

Markdown
A lightweight markup language.
A second definition for the same term.
Renderer
Software that transforms source syntax into another representation.

List item with indented code

  1. Before the code.

    package main

    func main() {}

  2. After the code.


Quotes and callouts

A simple blockquote with bold, italic, code, and a link.

A second paragraph.

Nested quote level two.

Nested quote level three with strike and \(x^2\).

[!NOTE] GitHub-style note alert.

[!TIP] A tip with inline code.

[!IMPORTANT] Important content.

[!WARNING] Warning content.

[!CAUTION] Caution content.

!!! note “Admonition extension” This indented admonition form is used by some Markdown engines.


Indented and HTML code

Four-space indented code:

<div class="not-rendered">Indented HTML-like code</div>
**Markdown is literal here.**

All fenced-code tests live in codeblockstest.md.


Tables

Alignment and inline styles

Left Center Right Default
bold italic code strike
link 24px \(x^2\) mark
H2O x2 Enter 😀
escaped | pipe a \| b &vert; entity underline
bold italic bold and code bold link deleted

Empty, wide, and numeric cells

Empty left Empty right Number Decimal Boolean Null-like
value 1 3.14159 true null
value -42 0.0001 false NIL
1,000,000 6.022e23 yes N/A

Images with varied aspect ratios in a table

Square Landscape Portrait Panorama
square landscape portrait panorama

Multiline and code-block table limitations

Standard pipe-table cells cannot portably contain block elements or fenced code. These alternatives test common renderer behavior:

Technique Content
HTML line break first line
second line
third line
Inline code const answer = 42;
Literal fence ```js
console.log(42)
```
HTML preformatted block
const answer = 42;
console.log(answer);

Raw HTML table with a genuine block code cell:

HTML table with rich cell contents
KindRendered content
Code block
.card {
  display: grid;
  gap: 1rem;
}
Nested list
  • One
  • Two
Image wide table image

Math

Math requires a renderer such as KaTeX or MathJax. Markdown emphasis generally does not apply inside LaTeX; use LaTeX styling commands instead.

Inline forms: \(E = mc^2\), (a^2 + b^2 = c^2), \(\frac{1}{2}\), \(\sqrt[n]{x}\), \(x_i^j\), and \(\mathbf{F} = m\vec{a}\).

Styled surrounding text: Einstein: \(E=mc^2\), Euler: \(e^{i\pi}+1=0\), obsolete guess \(x=0\), and highlighted equation \(y=mx+b\).

LaTeX-internal styles: \(\mathbf{bold}\), \(\mathit{italic}\), \(\mathrm{roman}\), \(\mathsf{sans}\), \(\mathtt{mono}\), \(\mathcal{C}\), \(\mathbb{R}\), \(\boldsymbol{\alpha}\), and \(\color{red}{x^2}\).

Display equation with dollar delimiters:

\[ \int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi} \]

Display equation with bracket delimiters:

[ \sum_{n=1}^{\infty}\frac{1}{n^2}=\frac{\pi^2}{6} ]

Fractions, roots, limits, products, and integrals:

\[ \lim_{x\to 0}\frac{\sin x}{x}=1,\qquad \prod_{k=1}^{n}k=n!,\qquad \sqrt{\frac{-b\pm\sqrt{b^2-4ac}}{2a}} \]

Matrix:

\[ A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} \]

Cases:

\[ f(x)=\begin{cases} x^2, & x\ge 0, \\ -x, & x<0. \end{cases} \]

Aligned equations:

\[ \begin{aligned} (a+b)^2 &= a^2+2ab+b^2 \\ (a-b)^2 &= a^2-2ab+b^2 \\ (a+b)(a-b) &= a^2-b^2 \end{aligned} \]

Sets, logic, and Greek letters:

\[ \forall x\in\mathbb{R},\; \exists y\in\mathbb{R}: y>x \quad\land\quad \alpha+\beta+\gamma+\Delta+\Omega \]

Escaped currency versus math: The price is $5, while $x$ is literal code and \(\\)x$ tests an escaped dollar inside math.


Footnotes and references

A simple footnote.[^simple] A named footnote with style, code, and a link.[^styled] The same repeated footnote appears again.[^simple] An inline footnote extension may look like this.^[Inline footnote content.]

Multiline footnote reference.[^multiline]

[^simple]: This is a simple footnote.

[^styled]: Footnote with bold, italic, strike, code, \(x^2\), and a link.

[^multiline]: First paragraph of a multiline footnote.

Second paragraph, indented beneath the footnote.

- A nested list item
- Another item with `code`

An indented code-like line inside a footnote.

Abbreviation extension: HTML and CSS are commonly used together.

*[HTML]: HyperText Markup Language *[CSS]: Cascading Style Sheets

Citation extension: Rendering research [@commonmark; @gfm].


Raw HTML

Expandable details with code

A paragraph containing highlighting, H2O, x2, and a link.

Semantic article header

W3C, Example Work, inline quotation, , and forty-two.

Ruby annotation: (かん)().

Progress: 67%

Meter: 72

Keyboard sequence: Ctrl + Shift + P.

Description list:

Term
Definition with strong text.
Another term
Another definition.

An HTML blockquote.

Raw HTML preformatted text
  preserves indentation
    and whitespace.

فقرة عربية من اليمين إلى اليسار.


Alternate front matter examples shown literally

The document already begins with YAML front matter. TOML and JSON front matter cannot simultaneously serve as active metadata. Their fenced representations are in codeblockstest.md.


Escapes and edge cases

This is intentionally the final section so escaping failures cannot affect later tests.

Backslash-escapable ASCII punctuation

! \” # $ \% & \’ ( ) * + \, - . \/ : \; < \= > \? \@ [ \ ] ^ _ ` { | } ~

Escaped Markdown examples: *not italic*, _not italic_, *not bold*,
# not a heading, [not a link](https://example.com), `not code`, 1. not a list, - not a list, and > not a quote.

Backslash runs: \ is inline code, \ is two source backslashes, and \* tests odd/even escape behavior before an asterisk.

Escaped entities and URL characters: &amp; \?query\=one&two #fragment \%20.

Ambiguous delimiters and empty constructs



and ` and and and <> and < >.

alpha beta gamma delta

Nested brackets: outer [inner text] still outer.

Nested parentheses in destination: parentheses.

Escaped destination: escaped paren.

Angle destination: spaces allowed in angle destination.

Thematic breaks







Text direction and character stress

LTR then RTL: English before العربية after English.

Directional HTML: ABC אבג 123 XYZ.

CJK without spaces: 日本語の長い文章が改行と折り返しをテストします。

Combining marks: a̐ é ö̲ Z̬̥̮̺̫̖͑ͫ̓ͪ͆ͧ̚̕͘.

Zero-width stress between brackets (the middle pair contains a zero-width space): [] versus [​].

Very long unbroken token:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

Deep blockquote stress

Level 1

Level 2

Level 3

Level 4

Level 5

Level 6

Level 7

Level 8

Repeated mixed-style stress

Bold italic code strike link mark H2O x2 \(x^2\)

Escaped terminator stress at end of file: \ * _ # [ ] ( ) { } | ~ `