Fenced Code Block Renderer Tests
This file isolates fenced-code syntax from the general Markdown renderer test.
No language
literal <tag>
**not bold** and $not_math$
JavaScript
const message = `Markdown delimiters: ** _ ~~`;
console.log(message);
Go
package main
import "fmt"
func main() {
fmt.Println("Hello, Markdown!")
}
Shell
set -euo pipefail
printf '%s\n' "hello"
JSON
{"string":"value","number":42,"boolean":true,"null":null,"array":[1,2,3]}
HTML
<article aria-label="Example">
<h1>Literal HTML source</h1>
</article>
Markdown
# Literal heading
- **Literal bold list item**
- [Literal link](https://example.com)
LaTeX
\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}
Unknown language
token one two three
Long line
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Empty block
Leading and trailing blank lines
content surrounded by blank lines
Delimiters inside code
Backticks shown as text: ` and ``.
Markdown: **bold** *italic* ~~strike~~ [link](https://example.com)
HTML: <strong>not rendered as HTML</strong>
Math: $x^2$ and \[y = mx + b\]
Escapes: \* \_ \# \[ \] \\ \`
TOML front matter shown literally
+++
title = "TOML front matter example"
draft = true
tags = ["markdown", "test"]
+++
JSON front matter shown literally
{
"title": "JSON front matter example",
"draft": true,
"tags": ["markdown", "test"]
}
Code block in a list
- Before the block.
const answer: number = 42;
- After the block.
Code block in a quote
Quoted code follows:
print("quoted code")
Code block in a footnote
Footnote containing code.[^code]
[^code]: The block follows.
```text
fenced code nested in a footnote
```
Consecutive blocks
.card { display: grid; }
SELECT 42 AS answer;
enabled: true
items:
- one
- two
Final escape test
The final block checks escape characters without placing malformed fences after it.
\! \" \# \$ \% \& \' \( \) \* \+ \, \- \. \/ \: \; \< \= \>
\? \@ \[ \\ \] \^ \_ \` \{ \| \} \~