Skip to content

Latest commit

 

History

History
703 lines (461 loc) · 11 KB

File metadata and controls

703 lines (461 loc) · 11 KB

Markdown Rendering Test Suite

This file intentionally mixes many Markdown patterns in one document. It is designed to test parser correctness, incremental re-rendering, cursor behavior, selection mapping, and source/render mode switching.


1. Paragraphs, line breaks, blank lines

Simple paragraph.

Paragraph with two spaces at end to force a hard line break.
Next line after hard break.

Paragraph with a soft line break next line should stay in the same paragraph unless renderer collapses it visually.

Paragraph separated by a blank line.

Very short paragraph after heading


2. Headings

H1 Heading

H2 Heading

H3 Heading

H4 Heading

H5 Heading
H6 Heading

Setext heading level 1

Setext heading level 2


3. Emphasis, strong, nested emphasis, and edge cases

italic

italic

bold

bold

bold italic

bold italic

italic bold

This is bold with italic inside and more bold.

This is italic with bold inside and more italic.

Underscore inside words should not always trigger emphasis: foobarbaz.

Asterisks adjacent to punctuation: thisshouldbe tested.

Nested emphasis with escaping: *not italic* and _not italic_.


4. Inline code and code spans

inline code

inline `code` with backticks

inline ``code`` with longer delimiter

A code span can contain punctuation: if (a < b && c > d) { return x; }

A code span can contain emphasis markers literally: *not emphasized*

A code span can contain links literally: [text](https://example.com)

Code span with leading and trailing spaces preserved by delimiter rules: spaced

Code span across line breaks: line 1 line 2

Backticks in normal text: ` and `` and ```


5. Links, images, autolinks, reference links

inline link

inline link with title

link with parentheses

reference link

collapsed reference

shortcut reference

image alt

reference image

https://example.com

mailto:test@example.com

Autolink-like text should stay literal when escaped: \https://example.com


6. Lists

  • Item 1
  • Item 2
  • Item 3
  1. Ordered item 1

  2. Ordered item 2

  3. Ordered item 3

  4. Ordered with explicit start

  5. Another ordered item

  6. Next item

  • Mixed list item

    • Nested bullet
    • Nested bullet with paragraph
  • Item with paragraph

    Continued paragraph inside list item.

  • Item with code block

    let x = 1;
    let y = 2;
    
  1. Item with nested quote

quoted text

quoted paragraph two

  • Item with task list style syntax

    • unchecked task
    • checked task
  • Item with emphasis and link: bold and link


7. Blockquotes

Blockquote paragraph one.

Blockquote paragraph two with bold and code.

Nested quote level 1

Nested quote level 2

Nested quote level 3

Quote with list:

  • item 1
  • item 2
    • nested item

Quote with code block:

fn main() {
    println!("hello");
}

8. Code blocks

Indented code block:

fn main() {
    println!("indented code block");
}

Fenced code block with language:

fn main() {
    println!("fenced code block");
}

Fenced code block with info string and meta:

flowchart TD
  A[Start] --> B{Decision}
  B -->|Yes| C[Result]
  B -->|No| D[Retry]
Loading

Fence containing backticks inside should still work:

This line contains `backticks` literally.

Longer fence to contain triple backticks:

```
nested fence content
```

Additional language coverage:

echo "hello"
if [ -f ./file.txt ]; then
  echo ok
fi
int add(int a, int b) {
    return a + b;
}
class Box {
public:
    int value = 1;
};
class App {
    static void Main() {
        var value = 42;
    }
}
.card {
  color: #fff;
  display: grid;
}
package main

func main() {
    println("hello")
}
<div class="card">
  <span>Hello</span>
</div>
class App {
    int add(int a, int b) {
        return a + b;
    }
}
<?php
echo "hello";
$value = 42;
?>
def double(x: int) -> int:
    return x * 2
def hello(name)
  puts "Hello, #{name}"
end
service:
  name: velotype
  enabled: true
[package]
name = "velotype"
edition = "2024"
const App = () => <button className="primary">OK</button>;
type User = { id: number };
const App = (): JSX.Element => <div data-id={1}>TSX</div>;

9. Horizontal rules




Paragraph above and below horizontal rule should remain distinct.

Text

Another paragraph-like setext case.


10. HTML blocks and inline HTML

HTML block with inline HTML.

Inline HTML paragraph with emphasis inside HTML.

Custom element test:

Expandable summary

Hidden content with inline code and bold.

Raw HTML comment should not render visibly:


11. Escapes and entities

* escaped asterisk *

_ escaped underscore _

` escaped backtick `

[ escaped bracket ]

\# escaped heading marker

\> escaped blockquote marker

© & < > "

AT&T should remain readable.


12. Tables

Left Center Right
a b c
bold code link
multiline
html
image alt text
Pipe in cell Escaped pipe
A | B literal pipe

Table with inline formatting inside cells:

Syntax Example
Emphasis italic
Strong bold
Code code
Link text

13. Task lists

  • Unchecked task
  • Checked task
  • Task with bold and code
  • Task with link
  • Task with nested list
    • nested unchecked
    • nested checked

14. Footnotes

Here is a footnote reference.1

Here is another footnote reference.2

A footnote can appear after multiple paragraphs, lists, and code blocks.


15. Strikethrough

strikethrough

This is deleted text with bold and code.

Multiple tildes: not necessarily strike in every renderer


16. Definition list style (extension)

Term 1 : Definition 1

Term 2 : Definition 2 with bold and code.

Another term : First definition paragraph.

: Second definition paragraph.


17. Superscript and subscript style (extension)

x^2^

H~2~O

Mixed: E = mc^2^ and H~2~O in the same paragraph.


18. Emoji and mentions style (extension)

😄 🚀 ⚠️

@user-name

#123


19. Math style (extension)

Inline math: $E = mc^2$

Display math:

$$ \int_0^1 x^2 , dx = \frac{1}{3} $$

Math with Markdown-like content inside: $ \text{Use literal markdown?} $


20. Admonition / callout style (extension)

Note

This is a note callout.

It can include bold, code, and a list:

  • item 1
  • item 2

Warning

This is a warning callout with a nested blockquote:

inner quote

And a fenced code block:

console.log("warn");

21. Mixed composition stress tests

21.1 Inline nesting in paragraphs

Paragraph with bold, italic, code, and a link inside italic outside.

Paragraph with code containing [brackets] and *stars* and _underscores_ plus text.

Paragraph with a link containing emphasis text bold label.

Paragraph with an image and link: alt text and another link.

21.2 Block nesting

Blockquote

  1. Ordered item
  • Nested bullet
  • Nested bullet with bold
  1. Second ordered item
print("inside blockquote and list")

Paragraph after code block.

21.3 List nesting with blockquote and table

  • List item

    Quote inside list item

    A B
    1 2
  • List item with HTML block

    HTML inside list item

21.4 Link reference and emphasis collision

This reference should render correctly even with bold around it.

This shortcut reference should also work.

21.5 Fence + inline code + emphasis collision

This fenced block contains `inline code`, **bold**, and [links](https://example.com).

Outside the fence: inline code and bold and links.


22. Very tricky edge cases

Empty paragraph after blank line.

A paragraph after multiple blank lines.

A line ending with backslash for hard break.\ Next line.

A list item that starts with punctuation:

  • (Optional) item text
  • task syntax after punctuation

A blockquote with blank lines:

First paragraph in quote.

Second paragraph in quote.

A setext heading followed by a paragraph

Heading text

Paragraph after setext heading.

A fenced code block immediately after a paragraph:

{"key":"value"}

A blockquote immediately after a paragraph:

quoted immediately after paragraph

A thematic break immediately after a paragraph:

Paragraph

A table immediately after a paragraph:

A B
1 2

23. Raw source diagnostics helpers

Source range probe: alpha beta gamma

Delimiter density probe: a b c

Whitespace probe: left and right and center .

Mixed punctuation probe: (link) and img


24. Final mixed mega-block

Important

Final mixed block that combines:

  • bold
  • italic
  • inline code
  • link
  • image
  • strike

And a table:

k v
a 1
b 2

And a fenced code block:

export const answer = 42;

And a footnote reference.3

- one
- two

End of test file.

Footnotes

  1. Footnote text.

  2. Footnote text with bold, code, and a nested list:

    • item 1
    • item 2

    Second paragraph in the footnote.

  3. Final footnote text with nested list: