Raw
.
foo
.
<document source="<src>/index.md">
    <paragraph>
        foo
.

Hard-break
.
foo\
bar
.
<document source="<src>/index.md">
    <paragraph>
        foo
        <raw format="html" xml:space="preserve">
            <br />
        <raw format="latex" xml:space="preserve">
            \\
        bar
.

Strong:
.
**foo**
.
<document source="<src>/index.md">
    <paragraph>
        <strong>
            foo
.

Emphasis
.
*foo*
.
<document source="<src>/index.md">
    <paragraph>
        <emphasis>
            foo
.

Escaped Emphasis:
.
\*foo*
.
<document source="<src>/index.md">
    <paragraph>
        *foo*
.

Mixed Inline
.
a *b* **c** `abc` \\*
.
<document source="<src>/index.md">
    <paragraph>
        a
        <emphasis>
            b

        <strong>
            c

        <literal>
            abc
         \*
.

Inline Code:
.
`foo`
.
<document source="<src>/index.md">
    <paragraph>
        <literal>
            foo
.

Heading:
.
# foo
.
<document source="<src>/index.md">
    <section ids="foo" names="foo">
        <title>
            foo
.

Heading Levels:
.
# a
## b
### c
# d
.
<document source="<src>/index.md">
    <section ids="a" names="a">
        <title>
            a
        <section ids="b" names="b">
            <title>
                b
            <section ids="c" names="c">
                <title>
                    c
    <section ids="d" names="d">
        <title>
            d
.

Nested heading
.
> # heading
.
<document source="<src>/index.md">
    <block_quote>
        <rubric ids="heading" level="1" names="heading">
            heading
.

Block Code:
.
    foo
.
<document source="<src>/index.md">
    <literal_block language="none" xml:space="preserve">
        foo
.

Fenced Code:
.
```sh
foo
```
.
<document source="<src>/index.md">
    <literal_block language="sh" xml:space="preserve">
        foo
.

Fenced Code no language:
.
```
foo
```
.
<document source="<src>/index.md">
    <literal_block language="default" xml:space="preserve">
        foo
.

Fenced Code no language with trailing whitespace:
.
```  
foo
```
.
<document source="<src>/index.md">
    <literal_block language="default" xml:space="preserve">
        foo
.

Image empty:
.
![]()
.
<document source="<src>/index.md">
    <paragraph>
        <image alt="" candidates="{'*': '.'}" original_uri="" uri=".">
.

Image with alt and title:
.
![alt](src "title")
.
<document source="<src>/index.md">
    <paragraph>
        <image alt="alt" candidates="{'*': 'src'}" title="title" uri="src">
.

Image with escapable html:
.
![alt](http://www.google<>.com)
.
<document source="<src>/index.md">
    <paragraph>
        <image alt="alt" candidates="{'?': 'http://www.google%3C%3E.com'}" uri="http://www.google%3C%3E.com">
.

Block Quote:
.
> *foo*
.
<document source="<src>/index.md">
    <block_quote>
        <paragraph>
            <emphasis>
                foo
.

Bullet List:
.
- *foo*
* bar
.
<document source="<src>/index.md">
    <bullet_list bullet="-">
        <list_item>
            <paragraph>
                <emphasis>
                    foo
    <bullet_list bullet="*">
        <list_item>
            <paragraph>
                bar
.

Nested Bullets
.
- a
  - b
    - c
  - d
.
<document source="<src>/index.md">
    <bullet_list bullet="-">
        <list_item>
            <paragraph>
                a
            <bullet_list bullet="-">
                <list_item>
                    <paragraph>
                        b
                    <bullet_list bullet="-">
                        <list_item>
                            <paragraph>
                                c
                <list_item>
                    <paragraph>
                        d
.

Enumerated List:
.
1. *foo*

1) bar

para

10. starting
11. enumerator
.
<document source="<src>/index.md">
    <enumerated_list enumtype="arabic" prefix="" suffix=".">
        <list_item>
            <paragraph>
                <emphasis>
                    foo
    <enumerated_list enumtype="arabic" prefix="" suffix=")">
        <list_item>
            <paragraph>
                bar
    <paragraph>
        para
    <enumerated_list enumtype="arabic" prefix="" start="10" suffix=".">
        <list_item>
            <paragraph>
                starting
        <list_item>
            <paragraph>
                enumerator
.

Nested Enumrated List:
.
1. a
2. b
    1. c
.
<document source="<src>/index.md">
    <enumerated_list enumtype="arabic" prefix="" suffix=".">
        <list_item>
            <paragraph>
                a
        <list_item>
            <paragraph>
                b
            <enumerated_list enumtype="arabic" prefix="" suffix=".">
                <list_item>
                    <paragraph>
                        c
.

Sphinx Role containing backtick:
.
{code}``a=1{`}``
.
<document source="<src>/index.md">
    <paragraph>
        <literal classes="code">
            a=1{`}
.

Target:
.
(target)=
.
<document source="<src>/index.md">
    <target ids="target" names="target">
.

Target with whitespace:
.
(target with space)=
.
<document source="<src>/index.md">
    <target ids="target-with-space" names="target\ with\ space">
.

Comments:
.
line 1
% a comment
line 2
.
<document source="<src>/index.md">
    <paragraph>
        line 1
    <comment xml:space="preserve">
        a comment
    <paragraph>
        line 2
.

Block Break:
.
+++ string
.
<document source="<src>/index.md">
    <comment classes="block_break" xml:space="preserve">
        string
.

Link Reference:
.
[name][key]

[key]: https://www.google.com "a title"
.
<document source="<src>/index.md">
    <paragraph>
        <reference reftitle="a title" refuri="https://www.google.com">
            name
.

Link Reference short version:
.
[name]

[name]: https://www.google.com "a title"
.
<document source="<src>/index.md">
    <paragraph>
        <reference reftitle="a title" refuri="https://www.google.com">
            name
.

Block Quotes:
.
```{epigraph}
a b*c*

-- a**b**
```
.
<document source="<src>/index.md">
    <block_quote classes="epigraph">
        <paragraph>
            a b
            <emphasis>
                c
        <attribution>
            a
            <strong>
                b
.

Link Definition in directive:
.
```{note}
[a]
```

[a]: link
.
<document source="<src>/index.md">
    <note>
        <paragraph>
            <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="link" reftype="myst">
                <inline classes="xref myst">
                    a
.

Link Definition in nested directives:
.
```{note}
[ref1]: link
```

```{note}
[ref1]
[ref2]
```

```{note}
[ref2]: link
```
.
<document source="<src>/index.md">
    <note>
    <note>
        <paragraph>
            <pending_xref refdoc="index" refdomain="True" refexplicit="True" reftarget="link" reftype="myst">
                <inline classes="xref myst">
                    ref1

            [ref2]
    <note>
.

Footnotes [APPLY TRANSFORMS]:
.
[^a]

[^a]: footnote*text*
.
<document source="<src>/index.md">
    <paragraph>
        <footnote_reference auto="1" docname="index" ids="id1" refid="a">
            1
    <transition classes="footnotes">
    <footnote auto="1" backrefs="id1" docname="index" ids="a" names="a">
        <label>
            1
        <paragraph>
            footnote
            <emphasis>
                text
.

Footnotes nested blocks [APPLY TRANSFORMS]:
.
[^a]

[^a]: footnote*text*

    abc
xyz

    > a

    - b

    c

finish
.
<document source="<src>/index.md">
    <paragraph>
        <footnote_reference auto="1" docname="index" ids="id1" refid="a">
            1
    <paragraph>
        finish
    <transition classes="footnotes">
    <footnote auto="1" backrefs="id1" docname="index" ids="a" names="a">
        <label>
            1
        <paragraph>
            footnote
            <emphasis>
                text
        <paragraph>
            abc

            xyz
        <block_quote>
            <paragraph>
                a
        <bullet_list bullet="-">
            <list_item>
                <paragraph>
                    b
        <paragraph>
            c
.

Front Matter:
.
---
a: 1
b: foo
c:
    d: 2
---
.
<document source="<src>/index.md">
    <field_list>
        <field>
            <field_name>
                a
            <field_body>
                <paragraph>
                    <literal>
                        1
        <field>
            <field_name>
                b
            <field_body>
                <paragraph>
                    <literal>
                        foo
        <field>
            <field_name>
                c
            <field_body>
                <paragraph>
                    <literal>
                        {"d": 2}
.

Front Matter Biblio:
.
---
author: Chris Sewell
authors: Chris Sewell, Chris Hodgraf
organization: EPFL
address: |
    1 Cedar Park Close
    Thundersley
    Essex
contact: <https://example.com>
version: 1.0
revision: 1.1
status: good
date: 2/12/1985
copyright: MIT
dedication: |
    To my *homies*
abstract:
    Something something **dark** side
other: Something else
---
.
<document source="<src>/index.md">
    <field_list>
        <field>
            <field_name>
                author
            <field_body>
                <paragraph>
                    Chris Sewell
        <field>
            <field_name>
                authors
            <field_body>
                <paragraph>
                    Chris Sewell, Chris Hodgraf
        <field>
            <field_name>
                organization
            <field_body>
                <paragraph>
                    EPFL
        <field>
            <field_name>
                address
            <field_body>
                <paragraph>
                    1 Cedar Park Close

                    Thundersley

                    Essex

        <field>
            <field_name>
                contact
            <field_body>
                <paragraph>
                    <reference refuri="https://example.com">
                        https://example.com
        <field>
            <field_name>
                version
            <field_body>
                <paragraph>
                    1.0
        <field>
            <field_name>
                revision
            <field_body>
                <paragraph>
                    1.1
        <field>
            <field_name>
                status
            <field_body>
                <paragraph>
                    good
        <field>
            <field_name>
                date
            <field_body>
                <paragraph>
                    2/12/1985
        <field>
            <field_name>
                copyright
            <field_body>
                <paragraph>
                    MIT
        <field>
            <field_name>
                dedication
            <field_body>
                <paragraph>
                    To my
                    <emphasis>
                        homies

        <field>
            <field_name>
                abstract
            <field_body>
                <paragraph>
                    Something something
                    <strong>
                        dark
                     side
        <field>
            <field_name>
                other
            <field_body>
                <paragraph>
                    <literal>
                        Something else
.

Front Matter Bad Yaml:
.
---
a: {
---
.
<document source="<src>/index.md">
    <system_message level="2" line="1" source="<src>/index.md" type="WARNING">
        <paragraph>
            Malformed YAML [myst.topmatter]
.

Front Matter HTML Meta
.
---
myst:
    html_meta:
        keywords: Sphinx, documentation, builder
        description lang=en: An amusing story
        description lang=fr: Un histoire amusant
        http-equiv=Content-Type: text/html; charset=ISO-8859-1
---
.
<document source="<src>/index.md">
    <meta content="Sphinx, documentation, builder" name="keywords">
    <meta content="An amusing story" lang="en" name="description">
    <meta content="Un histoire amusant" lang="fr" name="description">
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
.

Full Test:
.
---
a: 1
---

(target)=
# header 1
## sub header 1

a *b* **c** `abc`

## sub header 2

x y [a](http://www.xyz.com) z

---

# header 2

```::python {a=1}
a = 1
```

[](target)
.
<document source="<src>/index.md">
    <field_list>
        <field>
            <field_name>
                a
            <field_body>
                <paragraph>
                    <literal>
                        1
    <target ids="target" names="target">
    <section ids="header-1" names="header\ 1">
        <title>
            header 1
        <section ids="sub-header-1" names="sub\ header\ 1">
            <title>
                sub header 1
            <paragraph>
                a
                <emphasis>
                    b

                <strong>
                    c

                <literal>
                    abc
        <section ids="sub-header-2" names="sub\ header\ 2">
            <title>
                sub header 2
            <paragraph>
                x y
                <reference refuri="http://www.xyz.com">
                    a
                 z
            <transition>
    <section ids="header-2" names="header\ 2">
        <title>
            header 2
        <literal_block language="::python" xml:space="preserve">
            a = 1
        <paragraph>
            <pending_xref refdoc="index" refdomain="True" refexplicit="False" reftarget="target" reftype="myst">
                <inline classes="xref myst">
.
