
# Awesome Markdown Showcase
════════════════════════════════════════════════════════════════════════════════

A single document that exercises every Markdown construct `md` understands —
CommonMark plus the GFM extensions (tables, strikethrough, task lists,
autolinks, footnotes) — including the awkward nestings that stress the renderer.
It doubles as a human-facing tour and a golden render fixture, so it stays valid
CommonMark+GFM and renders cleanly through every backend.


## Headings
────────────────────────────────────────────────────────────────────────────────

Section structure here uses ATX headings (`##` … `######`). All six ATX levels
and both setext levels appear below; levels deeper than six clamp to `######`
when rendered.


# Heading level 1 (ATX)
════════════════════════════════════════════════════════════════════════════════


## Heading level 2 (ATX)
────────────────────────────────────────────────────────────────────────────────

### Heading level 3 (ATX)

#### Heading level 4 (ATX)

##### Heading level 5 (ATX)

###### Heading level 6 (ATX)


# A setext level-1 heading
════════════════════════════════════════════════════════════════════════════════


## A setext level-2 heading
────────────────────────────────────────────────────────────────────────────────


## Paragraphs, breaks, escapes, and entities
────────────────────────────────────────────────────────────────────────────────

This is a paragraph with a soft break inside it: the source wraps onto a second
line here, and the renderer reflows both lines into one paragraph at the target
width.

This paragraph uses a hard break — note the trailing backslash —
so the renderer starts a brand-new line right here.

Backslash escapes keep punctuation literal: *not emphasis*, _not italic_, `not
code`, # not a heading, and a lone backslash \ survives intact.

Character entities resolve to their glyphs, while the same text shown as inline
code stays verbatim: `&copy;` renders as ©, `&hellip;` renders as …, `&amp;`
renders as &, and the numeric entity `&#42;` renders as *.


## Emphasis and inline styles
────────────────────────────────────────────────────────────────────────────────

Inline runs cover italic, bold, bold italic, strikethrough, and `inline code`.
They also combine: italic wrapping bold within it, bold wrapping `code` within
it, and a titled `code` link (https://example.com) that nests code inside a
link.


## Links and images
────────────────────────────────────────────────────────────────────────────────

• Inline link: the Rust website (https://www.rust-lang.org)
• Titled link: hover over me (https://example.com)
• Reference link: the reference style (https://example.com/reference) resolved
  from a definition below
• Collapsed reference: ref (https://example.com/reference) reuses the label as
  its text
• Angle autolink: https://example.com/autolink
• Bare GFM autolink: https://commonmark.org that is long enough to sit inline
• Inline image: a sample diagram (images/diagram.png)
• Reference image: alt for the logo (images/logo.png)
• Link wrapping an image: clickable badge (images/badge.png)
  (https://example.com)


## Lists
────────────────────────────────────────────────────────────────────────────────

### Unordered, nested three to four deep

• Level 1 bullet
  • Level 2 bullet
    • Level 3 bullet
      • Level 4 bullet (deepest)
  • Level 2 sibling with bold and `code`
• Level 1 sibling

### Ordered

1. First ordered item
2. Second ordered item
3. Third ordered item

### Mixed ordered and unordered

1. Ordered outer item
   • Unordered child of an ordered item
   • Second unordered child
     1. Ordered grandchild (mixed nesting)
     2. Second ordered grandchild
2. Second ordered outer item

### Tight versus loose

A tight list (no blank lines between items renders compactly):

• tight item one
• tight item two
• tight item three

A loose list (blank lines between items adds vertical spacing):

• loose item one

• loose item two

  A second paragraph inside the loose item keeps the list loose.

### Items containing several block types

1. A list item whose body holds multiple blocks:

   A second paragraph within the same item.

   > A blockquote nested inside the list item.

   • a sub-list under the item
   • a second sub-list entry

2. A sibling item to close the list.

### Task lists, including nested and styled items

[x] Completed top-level task
[ ] Pending top-level task
    [x] Nested completed subtask
    [ ] Nested pending subtask with struck text and a `code` span


## Blockquotes
────────────────────────────────────────────────────────────────────────────────

> A simple blockquote, long enough that it wraps onto a second rendered line
> when the target width is narrow.

> An outer quote.
>
> > A nested quote inside the outer one.
> >
> > > Three levels deep.

> ### A heading inside a quote
>
> • a list inside the quote
> • a second item
>
>     a fenced code block inside the quote


## Code
────────────────────────────────────────────────────────────────────────────────

A fenced block with a language tag (syntax highlighting in the ANSI backend):

    fn main() {
        let greeting = "Hello, world!";
        println!("{greeting}");
    }

A fenced block tagged `python`:

    def greet(name: str) -> str:
        return f"Hello, {name}!"

An indented code block (four leading spaces, no language, never reflowed):

    let answer = 42;
    assert_eq!(answer, 42);

And `inline code` sits inside ordinary prose.


## Tables
────────────────────────────────────────────────────────────────────────────────

Alignment (left, center, right), with inline formatting and a link+code cell:

| Left aligned                             | Centered | Right aligned |
|:-----------------------------------------|:--------:|--------------:|
| plain text                               |  `code`  |        bolded |
| `mdcore` (https://example.com) link+code |  italic  |        struck |
| a longer left cell                       |  middle  |         1,024 |

A wide table whose rows overflow a narrow terminal rather than wrapping:

| Module | Responsibility                          | Inputs       | Outputs      | Notes                     |
|:-------|:----------------------------------------|:-------------|:-------------|:--------------------------|
| parser | lower CommonMark+GFM into the owned AST | source text  | `Document`   | enforces hardening limits |
| layout | reflow blocks and inlines to a width    | `Document`   | styled lines | shared by both backends   |
| ansi   | turn styled lines into escape sequences | styled lines | ANSI string  | OSC 8 links, truecolor    |


## Horizontal rules
────────────────────────────────────────────────────────────────────────────────

Three thematic-break syntaxes each render as a full-width rule:

────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────


## Footnotes
────────────────────────────────────────────────────────────────────────────────

A footnote can be referenced once[^single], reused at a second site[^multi], and
pointed at a definition[^multi] that spans multiple paragraphs.


## Inline and block HTML (inert)
────────────────────────────────────────────────────────────────────────────────

Raw HTML is captured but never executed — it renders as literal, inert text.
Inline: press <kbd>Ctrl</kbd>+<kbd>C</kbd> to copy, and water is H<sub>2</sub>O.

<div class="callout">
  <strong>Note:</strong> this raw HTML block is shown verbatim &amp; inert.
  <script>alert("this script never runs");</script>
</div>


## Adversarial nesting
────────────────────────────────────────────────────────────────────────────────

A blockquote containing a nested task list whose item carries a code span:

> Checklist captured inside a quote:
>
> [ ] top-level task in the quote
>     [x] nested task done, with an inline `code span` inside it

A list item that contains a fenced code block immediately followed by a
sub-list:

1. Build, then verify:

       cargo build -p mdcli
       md examples/showcase.md

   • the fenced block above sits between two block siblings
   • this sub-list follows the code with no blank-line ambiguity

A table cell that packs a link, inline code, and emphasis together:

| Scenario             | Rendered content                               |
|:---------------------|:-----------------------------------------------|
| link + code + accent | `md` (https://example.com) renders inline here |

[^single]: A single-paragraph footnote definition.

[^multi]: The first paragraph of a multi-paragraph footnote.

          A second paragraph, indented four spaces so it stays inside the
          footnote definition instead of starting a new top-level block.
