===============================================================================
Paragraph: simple
===============================================================================
Line

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Paragraph: empty line
===============================================================================
Line

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Paragraph: multiline
===============================================================================
Line1
Line2
Line3

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Paragraph: with words
===============================================================================
Multiple words in paragraph

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Paragraph: two
===============================================================================
First

Second

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph))

===============================================================================
Paragraph: two multiline
===============================================================================
In
First

In
Second

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph))

===============================================================================
Heading: 1
===============================================================================
# Heading

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Heading: 2
===============================================================================
## Heading

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Heading: very long
===============================================================================
######################################### Heading

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Heading: multiple lines
===============================================================================
# Heading
# with
# lines

A paragraph

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content
        (marker)
        (marker)))
    (section_content
      (paragraph))))

===============================================================================
Heading: multiple lines no # prefix
===============================================================================
# Heading
with
lines

A paragraph

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content
        (marker)
        (marker)))
    (section_content
      (paragraph))))

===============================================================================
Heading 2: multiple lines
===============================================================================
## Heading
with
lines

A paragraph

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content
        (marker)
        (marker)))
    (section_content
      (paragraph))))

===============================================================================
Heading: closed by higher heading on the next line
===============================================================================
# One
## Two

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))
    (section_content
      (section
        (heading
          (marker)
          (content))))))

===============================================================================
Heading: closed by lower heading on the next line
===============================================================================
## One
# Two

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content)))
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Heading 4: div closes
===============================================================================
:::
#### Heading
:::

stop

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (content
      (heading
        (marker)
        (content)))
    (div_marker_end))
  (paragraph))

===============================================================================
Heading 6: list closes
===============================================================================
###### Heading
- a

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))
    (section_content
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)))))))

===============================================================================
Heading: before list
===============================================================================
# Heading

- a

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))
    (section_content
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)))))))

===============================================================================
Heading: after list
===============================================================================
- list

# Heading

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph))))
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Section: closed by the same level
===============================================================================
# First

# Second

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))
    (section_content))
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Section: closed by a lower level
===============================================================================
## First

# Second

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))
    (section_content))
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Section: not closed by higher level
===============================================================================
# First

## Second

### Third

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))
    (section_content
      (section
        (heading
          (marker)
          (content))
        (section_content
          (section
            (heading
              (marker)
              (content))))))))

===============================================================================
Section: only allow sections on top level
===============================================================================
# First

- text

  # Second

-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))
    (section_content
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)
            (heading
              (marker)
              (content))))))))

===============================================================================
Block quote: oneline
===============================================================================
> This is a block quote.

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (paragraph))))

===============================================================================
Block quote: directly after
===============================================================================
> One
> Two
> Three

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (paragraph
        (block_quote_marker)
        (block_quote_marker)))))

===============================================================================
Block quote: long
===============================================================================
> This is a block quote.
>
> This is included

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (paragraph)
      (block_quote_marker)
      (block_quote_marker)
      (paragraph))))

===============================================================================
Block quote: lazy
===============================================================================
> This is a block quote.
This is included

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (paragraph))))

===============================================================================
Block quote: lazy short words
===============================================================================
> abc
def
ghi

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (paragraph))))

===============================================================================
Block quote: multilevel close nesting
===============================================================================
> > > a
> b

c

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (block_quote
        (block_quote_marker)
        (content
          (block_quote
            (block_quote_marker)
            (content
              (paragraph)))))
      (block_quote_marker)
      (paragraph)))
  (paragraph))

===============================================================================
Block quote: multilevel nesting with space
===============================================================================
> > a
>
> b

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (block_quote
        (block_quote_marker)
        (content
          (paragraph)))
      (block_quote_marker)
      (block_quote_marker)
      (paragraph))))

===============================================================================
Block quote: with hard line break
===============================================================================
> a \
> b

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (paragraph
        (hard_line_break)
        (block_quote_marker)))))

===============================================================================
Block quote: contain code block
===============================================================================
> ``` lang
> code

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (code_block
        (code_block_marker_begin)
        (language)
        (code
          (block_quote_marker))))))

===============================================================================
Code block: without langugae
===============================================================================
```
Some text
here
```

-------------------------------------------------------------------------------

(document
  (code_block
    (code_block_marker_begin)
    (code)
    (code_block_marker_end)))

===============================================================================
Code block: empty
===============================================================================
```
```

-------------------------------------------------------------------------------

(document
  (code_block
    (code_block_marker_begin)
    (code_block_marker_end)))

===============================================================================
Code block: before short paragraph
===============================================================================
```
x
```

z

-------------------------------------------------------------------------------

(document
  (code_block
    (code_block_marker_begin)
    (code)
    (code_block_marker_end))
  (paragraph))

===============================================================================
Code block :lang
===============================================================================
``` rust
Some text
here
```

-------------------------------------------------------------------------------

(document
  (code_block
    (code_block_marker_begin)
    (language)
    (code)
    (code_block_marker_end)))

===============================================================================
Code block: 3 ` escapes 4
===============================================================================
```
x
````
y
```

-------------------------------------------------------------------------------

(document
  (code_block
    (code_block_marker_begin)
    (code)
    (code_block_marker_end)))

===============================================================================
Code block: don't parse heading
===============================================================================
```
# x
```

-------------------------------------------------------------------------------

(document
  (code_block
    (code_block_marker_begin)
    (code)
    (code_block_marker_end)))

===============================================================================
Code block: in list should be closed before unindented code block
===============================================================================
- List

  ```
  First code

```
Second code
```

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (code_block
          (code_block_marker_begin)
          (code)))))
  (code_block
    (code_block_marker_begin)
    (code)
    (code_block_marker_end)))

===============================================================================
Raw block: with space before language
===============================================================================
``` =html
<p>txt</p>
```

-------------------------------------------------------------------------------

(document
  (raw_block
    (raw_block_marker_begin)
    (raw_block_info
      (language_marker)
      (language))
    (content)
    (raw_block_marker_end)))

===============================================================================
Raw block: in list should be closed before unindented raw block
===============================================================================
- a

  ```=html
  x

```=html
y
```

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (raw_block
          (raw_block_marker_begin)
          (raw_block_info
            (language_marker)
            (language))
          (content)))))
  (raw_block
    (raw_block_marker_begin)
    (raw_block_info
      (language_marker)
      (language))
    (content)
    (raw_block_marker_end)))

===============================================================================
Thematic break: star
===============================================================================
Before

   *    *    *

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (thematic_break)
  (paragraph))

===============================================================================
Thematic break: then paragraph
===============================================================================
***
After

-------------------------------------------------------------------------------

(document
  (thematic_break)
  (paragraph))

===============================================================================
Thematic break: minus
===============================================================================
Before

 - - -

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (thematic_break)
  (paragraph))

===============================================================================
Thematic break: star 2 + 1
===============================================================================
Before

** * *****

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (thematic_break)
  (paragraph))

===============================================================================
Thematic break: star 1 + 2
===============================================================================
Before

** *

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (thematic_break)
  (paragraph))

===============================================================================
Thematic break: minus 3 combined
===============================================================================
Before

---

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (thematic_break)
  (paragraph))

===============================================================================
Thematic break: minus 2 + 1
===============================================================================
Before

-- - --

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (thematic_break)
  (paragraph))

===============================================================================
Thematic break: minus 1 + 2
===============================================================================
Before

- -- - --

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (thematic_break)
  (paragraph))

===============================================================================
Link reference definition: simple
===============================================================================
[ref]: /url

-------------------------------------------------------------------------------

(document
  (link_reference_definition
    (link_label)
    (link_destination)))

===============================================================================
Link reference definition: destination not required
===============================================================================
[ref]:

-------------------------------------------------------------------------------

(document
  (link_reference_definition
    (link_label)))

===============================================================================
Link reference definition: multiple with emphasis
===============================================================================
[ref_]: /url
[ref_]: /url

-------------------------------------------------------------------------------

(document
  (link_reference_definition
    (link_label)
    (link_destination))
  (link_reference_definition
    (link_label)
    (link_destination)))

===============================================================================
Link reference definition: no newlines
===============================================================================
[ref
one]: /url
[ref
two]: /url

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Link reference definition: multiple close
===============================================================================
Some text

[ref1]: /url
[ref1]: /url
[ref1]: /url

-------------------------------------------------------------------------------

(document
  (paragraph)
  (link_reference_definition
    (link_label)
    (link_destination))
  (link_reference_definition
    (link_label)
    (link_destination))
  (link_reference_definition
    (link_label)
    (link_destination)))

===============================================================================
Link: inside list
===============================================================================
- [label](#ref)

+ [label](#ref)

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph
          (inline_link
            (link_text)
            (inline_link_destination))))))
  (list
    (list_item
      (list_marker_plus)
      (list_item_content
        (paragraph
          (inline_link
            (link_text)
            (inline_link_destination)))))))

===============================================================================
Block attribute: class
===============================================================================
{.bar}
Paragraph

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (class)))
  (paragraph))

===============================================================================
Block attribute: spaces
===============================================================================
{ .bar }
Paragraph

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (class)))
  (paragraph))

===============================================================================
Block attribute: identifier
===============================================================================
{#id}
Paragraph

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (paragraph))

===============================================================================
Block attribute: key value
===============================================================================
{author=value}
Paragraph

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (key_value
        (key)
        (value))))
  (paragraph))

===============================================================================
Block attribute: key value spaces
===============================================================================
{author="with spaces"}
Paragraph

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (key_value
        (key)
        (value))))
  (paragraph))

===============================================================================
Block attribute: mixed
===============================================================================
{.one .two #id author="with spaces"}
Paragraph

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (class)
      (class)
      (identifier)
      (key_value
        (key)
        (value))))
  (paragraph))

===============================================================================
Block attribute: with comment
===============================================================================
{#id % some text here %}
Paragraph

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)
      (comment
        (content))))
  (paragraph))

===============================================================================
Block attribute: before heading
===============================================================================
{#new-id}
# Heading

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Block attribute: before table
===============================================================================
{#id}
| a | b |

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (table
    (table_row
      (table_cell)
      (table_cell))))

===============================================================================
Block attribute: before list
===============================================================================
{#id}
1. List

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (list
    (list_item
      (list_marker_decimal_period)
      (list_item_content
        (paragraph)))))

===============================================================================
Block attribute: before blockquote
===============================================================================
{#id}
> Blockquote

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (block_quote
    (block_quote_marker)
    (content
      (paragraph))))

===============================================================================
Block attribute: before div
===============================================================================
{#id}
::: div
ok
:::

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (div
    (div_marker_begin)
    (class_name)
    (content
      (paragraph))
    (div_marker_end)))

===============================================================================
Block attribute: before code block
===============================================================================
{#id}
```rust
let x = 2;
```

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (code_block
    (code_block_marker_begin)
    (language)
    (code)
    (code_block_marker_end)))

===============================================================================
Block attribute: before link def
===============================================================================
{#id}
[ref]: /url

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (link_reference_definition
    (link_label)
    (link_destination)))

===============================================================================
Block attribute: before thematic break
===============================================================================
{#id}
---

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (identifier)))
  (thematic_break))

===============================================================================
Block attribute: inside list
===============================================================================
- Before

  {.class}


-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (block_attribute
          (args
            (class)))))))

===============================================================================
Block attribute: inside block quote
===============================================================================
> x
>
> {.class}
> a

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (paragraph)
      (block_quote_marker)
      (block_quote_marker)
      (block_attribute
        (args
          (class)))
      (block_quote_marker)
      (paragraph))))

===============================================================================
Block attribute: must be first
===============================================================================
x {author=value}

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Block attribute: single new line ok if indented
===============================================================================
{.c
 #i}

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (class)
      (identifier))))

===============================================================================
Block attribute: not okay if not indented
===============================================================================
{.c
#i}

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Block attribute: indent inside list
===============================================================================
- a

  {.c
   #i}
  x

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (block_attribute
          (args
            (class)
            (identifier)))
        (paragraph)))))

===============================================================================
Block attribute: not okay if two newlines in a row
===============================================================================
{.c

 #i}

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph))

===============================================================================
Block attribute: comment closed at }
===============================================================================
{% comment }

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (comment
        (content)))))

===============================================================================
Block attribute: comment can contain newlines
===============================================================================
{% a
 b
 c
 %}

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (comment
        (content)))))

===============================================================================
Block attribute: comment newlines must match indent
===============================================================================
{% a
c
 %}

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Block attribute: comment before link def
===============================================================================
{% c %}
[def]: /url

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (comment
        (content))))
  (link_reference_definition
    (link_label)
    (link_destination)))

===============================================================================
Block attribute: comment before heading
===============================================================================
{% c %}
# one

-------------------------------------------------------------------------------

(document
  (block_attribute
    (args
      (comment
        (content))))
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Div: simple
===============================================================================
:::
Inside

:::

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (content
      (paragraph))
    (div_marker_end)))

===============================================================================
Div: class
===============================================================================
::: myclass
Inside

:::

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (class_name)
    (content
      (paragraph))
    (div_marker_end)))

===============================================================================
Div: class_snake
===============================================================================
::: snake_case
Inside

:::

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (class_name)
    (content
      (paragraph))
    (div_marker_end)))

===============================================================================
Div: kebab-case
===============================================================================
::: kebab-case
Inside

:::

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (class_name)
    (content
      (paragraph))
    (div_marker_end)))

===============================================================================
Div: end paragraph inside
===============================================================================
:::
Inside
:::

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (content
      (paragraph))
    (div_marker_end)))

===============================================================================
Div: eof closes
===============================================================================
:::
Inside

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (content
      (paragraph))))

===============================================================================
Div: nested
===============================================================================
:::
1

::::
2
::::

:::

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (content
      (paragraph)
      (div
        (div_marker_begin)
        (content
          (paragraph))
        (div_marker_end)))
    (div_marker_end)))

===============================================================================
Div: close nested div
===============================================================================
:::
1

::::
2

:::

-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (content
      (paragraph)
      (div
        (div_marker_begin)
        (content
          (paragraph))))
    (div_marker_end)))

===============================================================================
Div: inside block quote
===============================================================================
> :::
> a
> :::

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (div
        (div_marker_begin)
        (content
          (paragraph
            (block_quote_marker)))
        (block_quote_marker)
        (div_marker_end)))))

===============================================================================
Div: in list should be closed before heading
===============================================================================
- List

  :::
  unclosed div

# heading

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (div
          (div_marker_begin)
          (content
            (paragraph))))))
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Div: in list should be closed before unindented div
===============================================================================
- List

  :::
  nested div

:::
outside div
:::

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (div
          (div_marker_begin)
          (content
            (paragraph))))))
  (div
    (div_marker_begin)
    (content
      (paragraph))
    (div_marker_end)))

===============================================================================
Paragraph: not recognized
===============================================================================
Before

--

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph
    (en_dash))
  (paragraph))

===============================================================================
Paragraph: not recognized 2
===============================================================================
Before

-

After

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph)
  (paragraph))

===============================================================================
List: single dash
===============================================================================
- Item

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: tight dashes
===============================================================================
- a
- b
- c

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: Close sublist
===============================================================================
- a

  - b

- c

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (list
          (list_item
            (list_marker_dash)
            (list_item_content
              (paragraph))))))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: multiple lists with space between (not separated due to simplicity)
===============================================================================
- a
- b

- x
- y

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: multiple lists with paragraph between
===============================================================================
- a
- b

paragraph

- x
- y

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph))))
  (paragraph)
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: Contain unindented paragraph closes list
===============================================================================
- First

Second

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph))))
  (paragraph))

===============================================================================
List: Continue paragraph with soft break
===============================================================================
- First
 Second

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: Continue paragraph with lazy indentation
===============================================================================
- First
Second

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: Contain multiple paragraphs
===============================================================================
- First

  Second

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (paragraph)))))

===============================================================================
List: Immediate blockquote
===============================================================================
- > a
  > b

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (block_quote
          (block_quote_marker)
          (content
            (paragraph
              (block_quote_marker))))))))

===============================================================================
List: Close contained code block at eof
===============================================================================
- ```
  b

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (code_block
          (code_block_marker_begin)
          (code))))))

===============================================================================
List: Close contained code at next non-indent
===============================================================================
- ```
  a

x

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (code_block
          (code_block_marker_begin)
          (code)))))
  (paragraph))

===============================================================================
List: Close contained multiline code at next non-indent
===============================================================================
- ```
  a

  b

x

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (code_block
          (code_block_marker_begin)
          (code)))))
  (paragraph))

===============================================================================
List: code block should ignore nested list
===============================================================================
- a

  ```
  x: 1
  ```

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (code_block
          (code_block_marker_begin)
          (code)
          (code_block_marker_end))))))

===============================================================================
List: raw block at end
===============================================================================
- a

  ```=html
  x
  ```

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (raw_block
          (raw_block_marker_begin)
          (raw_block_info
            (language_marker)
            (language))
          (content)
          (raw_block_marker_end))))))

===============================================================================
List: div at end
===============================================================================
- a

  :::
  x
  :::

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (div
          (div_marker_begin)
          (content
            (paragraph))
          (div_marker_end))))))

===============================================================================
List: Close contained div at eof
===============================================================================
- ::: mydiv
  a

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (div
          (div_marker_begin)
          (class_name)
          (content
            (paragraph)))))))

===============================================================================
List: Close contained div at next non-indent
===============================================================================
- ::: mydiv
  a

x

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (div
          (div_marker_begin)
          (class_name)
          (content
            (paragraph))))))
  (paragraph))

===============================================================================
List: With sublist
===============================================================================
- one
- two

  - sub
  - sub

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (list
          (list_item
            (list_marker_dash)
            (list_item_content
              (paragraph)))
          (list_item
            (list_marker_dash)
            (list_item_content
              (paragraph))))))))

===============================================================================
List: plus
===============================================================================
+ one
+ two

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_plus)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_plus)
      (list_item_content
        (paragraph)))))

===============================================================================
List: star
===============================================================================
* one
* two

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_star)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_star)
      (list_item_content
        (paragraph)))))

===============================================================================
List: mixed bullets create new lists
===============================================================================
- one
+ two
* tree

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_plus)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_star)
      (list_item_content
        (paragraph)))))

===============================================================================
List: close sublist
===============================================================================
+ one

  + sub

  inner

outer

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_plus)
      (list_item_content
        (paragraph)
        (list
          (list_item
            (list_marker_plus)
            (list_item_content
              (paragraph))))
        (paragraph))))
  (paragraph))

===============================================================================
List: definition
===============================================================================
: term

  Def

  More def

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_definition)
      (term)
      (definition
        (paragraph)
        (paragraph)))))

===============================================================================
List: ordered list markers
===============================================================================
1. x
1. x

1) x
1) x

(1) x
(1) x

a. x
a. x

a) x
a) x

(a) x
(a) x

A. x
A. x

A) x
A) x

(A) x
(A) x

i. x
i. x

i) x
i) x

(i) x
(i) x

I. x
I. x

I) x
I) x

(I) x
(I) x


-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_decimal_period)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_decimal_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_decimal_paren)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_decimal_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_decimal_parens)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_decimal_parens)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_alpha_period)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_lower_alpha_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_alpha_paren)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_lower_alpha_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_alpha_parens)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_lower_alpha_parens)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_alpha_period)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_upper_alpha_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_alpha_paren)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_upper_alpha_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_alpha_parens)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_upper_alpha_parens)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_roman_period)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_lower_roman_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_roman_paren)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_lower_roman_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_roman_parens)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_lower_roman_parens)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_roman_period)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_upper_roman_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_roman_paren)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_upper_roman_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_roman_parens)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_upper_roman_parens)
      (list_item_content
        (paragraph)))))

===============================================================================
List: multi letter ordered list markers
===============================================================================

10. x

10) x

(10) x

aa. x

aa) x

(aa) x

AA. x

AA) x

(AA) x

ii. x

ii) x

(ii) x

II. x

II) x

(II) x

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_decimal_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_decimal_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_decimal_parens)
      (list_item_content
        (paragraph))))
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (list
    (list_item
      (list_marker_lower_roman_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_roman_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_roman_parens)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_roman_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_roman_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_upper_roman_parens)
      (list_item_content
        (paragraph)))))

===============================================================================
List: close decimal sublist
===============================================================================
1. one

  1. sub

  inner

outer

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_decimal_period)
      (list_item_content
        (paragraph)
        (list
          (list_item
            (list_marker_decimal_period)
            (list_item_content
              (paragraph))))
        (paragraph))))
  (paragraph))

===============================================================================
List: ordered list don't mix
===============================================================================
1. x
1) x
i) x
(a) x

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_decimal_period)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_decimal_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_roman_paren)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_lower_alpha_parens)
      (list_item_content
        (paragraph)))))

===============================================================================
List: task
===============================================================================
- [ ] a
- [x] b
- [X] c

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_task
        (unchecked))
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_task
        (checked))
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_task
        (checked))
      (list_item_content
        (paragraph)))))

===============================================================================
List: task mix multiple styles
===============================================================================
* [ ] a
+ [ ] b
- [ ] c

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_task
        (unchecked))
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_task
        (unchecked))
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_task
        (unchecked))
      (list_item_content
        (paragraph)))))

===============================================================================
List: not tasks
===============================================================================
- [ ]a

- [x]b

- [X]c

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: task list closed
===============================================================================
- [ ] a

+ x

- [ ] a

- x

+ [ ] a

* x

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_task
        (unchecked))
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_plus)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_task
        (unchecked))
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_task
        (unchecked))
      (list_item_content
        (paragraph))))
  (list
    (list_item
      (list_marker_star)
      (list_item_content
        (paragraph)))))

===============================================================================
List: double dash
===============================================================================
- -

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: in block quote
===============================================================================
> - a
> - b
> * a
> * b
> + a
> + b
> - [ ] a
> - [x] b

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_dash)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_star)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_star)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_plus)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_plus)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_task
            (unchecked))
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_task
            (checked))
          (list_item_content
            (paragraph)))))))

===============================================================================
List: Sparse list in block quote
===============================================================================
> - a
>
> - b
>

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (block_quote_marker)
          (list_marker_dash)
          (list_item_content
            (paragraph))))
      (block_quote_marker))))

===============================================================================
List: List definition in block quote
===============================================================================
> : x
>
>  a

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (list
        (list_item
          (list_marker_definition)
          (term)
          (definition
            (block_quote_marker)
            (paragraph)))))))

===============================================================================
List: In block quote with paragraph
===============================================================================
> - a
>
>  b

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)
            (block_quote_marker)
            (paragraph)))))))

===============================================================================
List: Unclosed List in Blockquote
===============================================================================
> a
>
> - b
-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (paragraph)
      (block_quote_marker)
      (block_quote_marker)
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)))))))

===============================================================================
List: Ordered list in Blockquote
===============================================================================
> 1. a
> 2. b
> 1) a
> 2) b
> (1) a
> (2) b
> a. a
> b. b
> a) a
> b) b
> (a) a
> (b) b
> A. a
> B. b
> A) a
> B) b
> (A) a
> (B) b
> i. a
> i. b
> i) a
> i) b
> (i) a
> (i) b
> I. a
> I. b
> I) a
> I) b
> (I) a
> (I) b

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (list
        (list_item
          (list_marker_decimal_period)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_decimal_period)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_decimal_paren)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_decimal_paren)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_decimal_parens)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_decimal_parens)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_lower_alpha_period)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_lower_alpha_period)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_lower_alpha_paren)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_lower_alpha_paren)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_lower_alpha_parens)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_lower_alpha_parens)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_upper_alpha_period)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_upper_alpha_period)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_upper_alpha_paren)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_upper_alpha_paren)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_upper_alpha_parens)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_upper_alpha_parens)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_lower_roman_period)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_lower_roman_period)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_lower_roman_paren)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_lower_roman_paren)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_lower_roman_parens)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_lower_roman_parens)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_upper_roman_period)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_upper_roman_period)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_upper_roman_paren)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_upper_roman_paren)
          (list_item_content
            (paragraph))))
      (block_quote_marker)
      (list
        (list_item
          (list_marker_upper_roman_parens)
          (list_item_content
            (paragraph)))
        (list_item
          (block_quote_marker)
          (list_marker_upper_roman_parens)
          (list_item_content
            (paragraph)))))))

===============================================================================
List: Unclosed List in Section
===============================================================================
# a

- b
-------------------------------------------------------------------------------

(document
  (section
    (heading
      (marker)
      (content))
    (section_content
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)))))))

===============================================================================
List: Unclosed List in Div
===============================================================================
::: a

- b
-------------------------------------------------------------------------------

(document
  (div
    (div_marker_begin)
    (class_name)
    (content
      (list
        (list_item
          (list_marker_dash)
          (list_item_content
            (paragraph)))))))

===============================================================================
List: Code block starts list
===============================================================================
- ```
  x
  ```

  a

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (code_block
          (code_block_marker_begin)
          (code)
          (code_block_marker_end))
        (paragraph)))))

===============================================================================
List: Nested divs with block attributes
===============================================================================
- x

  {#1}
  :::
  a
  :::

  {#2}
  :::
  b
  :::

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (block_attribute
          (args
            (identifier)))
        (div
          (div_marker_begin)
          (content
            (paragraph))
          (div_marker_end))
        (block_attribute
          (args
            (identifier)))
        (div
          (div_marker_begin)
          (content
            (paragraph))
          (div_marker_end))))))

===============================================================================
List: Nested code block between paragraphs
===============================================================================
- a

  ```
  x
  ```

  c

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (code_block
          (code_block_marker_begin)
          (code)
          (code_block_marker_end))
        (paragraph)))))

===============================================================================
List: Thematic break between paragraphs
===============================================================================
- a

  * * *

  b

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (thematic_break)
        (paragraph)))))

===============================================================================
List: Quote between paragraphs
===============================================================================
- a

  > c

  b

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (block_quote
          (block_quote_marker)
          (content
            (paragraph)))
        (paragraph)))))

===============================================================================
List: Link definition between paragraphs
===============================================================================
- a

  [def]: /u

  b

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (link_reference_definition
          (link_label)
          (link_destination))
        (paragraph)))))

===============================================================================
List: Footnote def between paragraphs
===============================================================================
- a

  [^def]: Footnote

  b

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (footnote
          (footnote_marker_begin)
          (reference_label)
          (footnote_marker_end)
          (footnote_content
            (paragraph)))
        (paragraph)))))

===============================================================================
List: Table between paragraphs
===============================================================================
- a

  | a | b |

  b

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (table
          (table_row
            (table_cell)
            (table_cell)))
        (paragraph)))))

===============================================================================
List: Extra space between (the Djot playground also treats them as one list)
===============================================================================
- a


- c

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: Code in list item
===============================================================================
- b

  ```
  x
  ```

- c

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (code_block
          (code_block_marker_begin)
          (code)
          (code_block_marker_end))))
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)))))

===============================================================================
List: With span in verbatim
===============================================================================
- x

  `[x]{y}`

-------------------------------------------------------------------------------

(document
  (list
    (list_item
      (list_marker_dash)
      (list_item_content
        (paragraph)
        (paragraph
          (verbatim
            (verbatim_marker_begin)
            (content)
            (verbatim_marker_end)))))))

===============================================================================
Table: single row
===============================================================================
| a | b |

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell)
      (table_cell))))

===============================================================================
Table: before paragraph
===============================================================================
| a | b |

z

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell)
      (table_cell)))
  (paragraph))

===============================================================================
Table: initial separator
===============================================================================
|---|---|
| a | b |

-------------------------------------------------------------------------------

(document
  (table
    (table_separator
      (table_cell_alignment)
      (table_cell_alignment))
    (table_row
      (table_cell)
      (table_cell))))

===============================================================================
Table: separator + header
===============================================================================
| x|y|
|--|--:|
| a | b |

-------------------------------------------------------------------------------

(document
  (table
    (table_header
      (table_cell)
      (table_cell))
    (table_separator
      (table_cell_alignment)
      (table_cell_alignment))
    (table_row
      (table_cell)
      (table_cell))))

===============================================================================
Table: separator alignments
===============================================================================
|----|---:|:---|:--:|
| a | b | c | d |

-------------------------------------------------------------------------------

(document
  (table
    (table_separator
      (table_cell_alignment)
      (table_cell_alignment)
      (table_cell_alignment)
      (table_cell_alignment))
    (table_row
      (table_cell)
      (table_cell)
      (table_cell)
      (table_cell))))

===============================================================================
Table: multiple headers
===============================================================================
|1|2|
|-|-|
|3|4|
|-|-|
|a|b|

-------------------------------------------------------------------------------

(document
  (table
    (table_header
      (table_cell)
      (table_cell))
    (table_separator
      (table_cell_alignment)
      (table_cell_alignment))
    (table_header
      (table_cell)
      (table_cell))
    (table_separator
      (table_cell_alignment)
      (table_cell_alignment))
    (table_row
      (table_cell)
      (table_cell))))

===============================================================================
Table: inside blockquote
===============================================================================
> | x|y|
> |--|--:|
> | a | b |

-------------------------------------------------------------------------------

(document
  (block_quote
    (block_quote_marker)
    (content
      (table
        (table_header
          (table_cell)
          (table_cell))
        (block_quote_marker)
        (table_separator
          (table_cell_alignment)
          (table_cell_alignment))
        (block_quote_marker)
        (table_row
          (table_cell)
          (table_cell))))))

===============================================================================
Table: with inline styling
===============================================================================
| _x_ | *y* |

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell
        (emphasis
          (emphasis_begin)
          (content)
          (emphasis_end)))
      (table_cell
        (strong
          (strong_begin)
          (content)
          (strong_end))))))

===============================================================================
Table: with caption
===============================================================================
| x | y |
^ caption _here_

Next paragraph

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell)
      (table_cell))
    (table_caption
      (marker)
      (content
        (emphasis
          (emphasis_begin)
          (content)
          (emphasis_end)))))
  (paragraph))

===============================================================================
Table: caption early end
===============================================================================
| x | y |
^ caption _here_
Next paragraph

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell)
      (table_cell))
    (table_caption
      (marker)
      (content
        (emphasis
          (emphasis_begin)
          (content)
          (emphasis_end)))))
  (paragraph))

===============================================================================
Table: spaced caption
===============================================================================
| x | y |

^ caption here

Next paragraph

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell)
      (table_cell))
    (table_caption
      (marker)
      (content)))
  (paragraph))

===============================================================================
Table: verbatim cell
===============================================================================
| `|` |

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell
        (verbatim
          (verbatim_marker_begin)
          (content)
          (verbatim_marker_end))))))

===============================================================================
Table: narrow verbatim cell
===============================================================================
|`|`|

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell
        (verbatim
          (verbatim_marker_begin)
          (content)
          (verbatim_marker_end))))))

===============================================================================
Table: backslashed pipe
===============================================================================
| \| |

-------------------------------------------------------------------------------

(document
  (table
    (table_row
      (table_cell
        (backslash_escape)))))

===============================================================================
Footnote: simple
===============================================================================
[^x]: a

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph))))

===============================================================================
Footnote: before heading
===============================================================================
[^x]: a

# b

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)))
  (section
    (heading
      (marker)
      (content))))

===============================================================================
Footnote: multiline
===============================================================================
[^foo]: Text
that continues

  Next paragraph

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)
      (paragraph))))

===============================================================================
Footnote: With block quote
===============================================================================
[^foo]: Text

  > block quote inside

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)
      (block_quote
        (block_quote_marker)
        (content
          (paragraph))))))

===============================================================================
Footnote: Code block starts footnote
===============================================================================
[^foo]: ```
        x
        ```

        a

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (code_block
        (code_block_marker_begin)
        (code)
        (code_block_marker_end))
      (paragraph))))

===============================================================================
Footnote: Nested divs with block attributes
===============================================================================
[^f]: x

     {#1}
     :::
     a
     :::

     {#2}
     :::
     b
     :::

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)
      (block_attribute
        (args
          (identifier)))
      (div
        (div_marker_begin)
        (content
          (paragraph))
        (div_marker_end))
      (block_attribute
        (args
          (identifier)))
      (div
        (div_marker_begin)
        (content
          (paragraph))
        (div_marker_end)))))

===============================================================================
Footnote: Nested code block between paragraphs
===============================================================================
[^f]: a

     ```
     x
     ```

     c

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)
      (code_block
        (code_block_marker_begin)
        (code)
        (code_block_marker_end))
      (paragraph))))

===============================================================================
Footnote: Thematic break between paragraphs
===============================================================================
[^f]: a

      * * *

      b

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)
      (thematic_break)
      (paragraph))))

===============================================================================
Footnote: Quote between paragraphs
===============================================================================
[^f]: a

      > c

      b

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)
      (block_quote
        (block_quote_marker)
        (content
          (paragraph)))
      (paragraph))))

===============================================================================
Footnote: Link definition between paragraphs
===============================================================================
[^f]: a

      [def]: /u

      b

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)
      (link_reference_definition
        (link_label)
        (link_destination))
      (paragraph))))

===============================================================================
Footnote: Table between paragraphs
===============================================================================
[^foo]: a

        | a | b |

        b

-------------------------------------------------------------------------------

(document
  (footnote
    (footnote_marker_begin)
    (reference_label)
    (footnote_marker_end)
    (footnote_content
      (paragraph)
      (table
        (table_row
          (table_cell)
          (table_cell)))
      (paragraph))))

===============================================================================
Paragraph: Errors if open inline aren't enforced
===============================================================================
*x*:

```

[^1]: *s*
*e*
```

[y](#)


-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end)))
  (code_block
    (code_block_marker_begin)
    (code)
    (code_block_marker_end))
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Paragraph: broken things
===============================================================================
|

-

+

*

[x]

[^f

{.a

{#a

{a=1

{%

{% a

{% a %

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph))

===============================================================================
Paragraph: Not list items
===============================================================================
a)s

a.b

1.a

i.e.

(a)(b)

-a

*a

+a

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph))

===============================================================================
Frontmatter: without language
===============================================================================
---
key: Some value
other_key: ["one", "two"]
---

x

-------------------------------------------------------------------------------

(document
  (frontmatter
    (frontmatter_marker)
    (frontmatter_content)
    (frontmatter_marker))
  (paragraph))

===============================================================================
Frontmatter: with language
===============================================================================
---toml
key: Some value
---

x

-------------------------------------------------------------------------------

(document
  (frontmatter
    (frontmatter_marker)
    (language)
    (frontmatter_content)
    (frontmatter_marker))
  (paragraph))

===============================================================================
Verbatim: single
===============================================================================
Simple `verbatim` here

-------------------------------------------------------------------------------

(document
  (paragraph
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))))

===============================================================================
Verbatim: with emphasis inside
===============================================================================
Simple `x _a_` here

-------------------------------------------------------------------------------

(document
  (paragraph
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))))

===============================================================================
Verbatim: double with single inside
===============================================================================
``verbatim with a backtick ` characters``

-------------------------------------------------------------------------------

(document
  (paragraph
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))))

===============================================================================
Verbatim: with triple inside
===============================================================================
`verbatim with three backtick ``` characters`

-------------------------------------------------------------------------------

(document
  (paragraph
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))))

===============================================================================
Verbatim: newline closes
===============================================================================
`verbatim

-------------------------------------------------------------------------------

(document
  (paragraph
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))))

===============================================================================
Verbatim: can contain newlines
===============================================================================
`verbatim
with
newlines`

-------------------------------------------------------------------------------

(document
  (paragraph
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))))

===============================================================================
Verbatim: multiple
===============================================================================
`x` `y`

-------------------------------------------------------------------------------

(document
  (paragraph
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))))

===============================================================================
Verbatim: with hash
===============================================================================
Don't consume `#` in heading parser code

-------------------------------------------------------------------------------

(document
  (paragraph
    (verbatim
      (verbatim_marker_begin)
      (content)
      (verbatim_marker_end))))

===============================================================================
Paragraph: todo note fixme
===============================================================================
Higlight TODO NOTE and FIXME

-------------------------------------------------------------------------------

(document
  (paragraph
    (todo)
    (note)
    (fixme)))

===============================================================================
Smart punctuation
===============================================================================

Ellipsis...
Em---dash
Eh--dash
Some{"quotes"} be{'here'}yo
 \"Straight\" \'quotes\'

-------------------------------------------------------------------------------

(document
  (paragraph
    (ellipsis)
    (em_dash)
    (en_dash)
    (quotation_marks)
    (quotation_marks)
    (quotation_marks)
    (quotation_marks)
    (quotation_marks)
    (quotation_marks)
    (quotation_marks)
    (quotation_marks)))

===============================================================================
Backslash escape
===============================================================================

No \_emphasis\_
No \_strong\_
No \<autolink>
Regular \.\.\. dots
Inside _x\_y_
No \{+insert\*}
\> no quote
\\
\ whitespace

-------------------------------------------------------------------------------

(document
  (paragraph
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)
    (emphasis
      (emphasis_begin)
      (content
        (backslash_escape))
      (emphasis_end))
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)
    (backslash_escape)))

===============================================================================
Image: inline with nested emphasis
===============================================================================
![descr](1_2_3_4_5)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_image
      (image_description)
      (inline_link_destination))))

===============================================================================
Image: inline
===============================================================================
![descr](/url)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_image
      (image_description)
      (inline_link_destination))))

===============================================================================
Image: empty inline
===============================================================================
![](/url)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_image
      (image_description)
      (inline_link_destination))))

===============================================================================
Image: collapsed reference link
===============================================================================
![img][]

-------------------------------------------------------------------------------

(document
  (paragraph
    (collapsed_reference_image
      (image_description))))

===============================================================================
Image: full reference
===============================================================================
![descr][ref]

-------------------------------------------------------------------------------

(document
  (paragraph
    (full_reference_image
      (image_description)
      (link_label))))

===============================================================================
Image: inline precedence 1
===============================================================================
![x *](y)*

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_image
      (image_description)
      (inline_link_destination))))

===============================================================================
Image: inline precedence 2
===============================================================================
*![*](y)

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Image: inline precedence 3
===============================================================================
*![x](y*)

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Image: full precedence 1
===============================================================================
![x *][y]*

-------------------------------------------------------------------------------

(document
  (paragraph
    (full_reference_image
      (image_description)
      (link_label))))

===============================================================================
Image: full precedence 2
===============================================================================
*![*][y]

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Image: full precedence 3
===============================================================================
*![x][y*]

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Image: collapsed precedence 1
===============================================================================
![x *][]*

-------------------------------------------------------------------------------

(document
  (paragraph
    (collapsed_reference_image
      (image_description))))

===============================================================================
Image: collapsed precedence 2
===============================================================================
*![*][]

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Image: collapsed precedence 3
===============================================================================
*![x][*]

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Image: document
===============================================================================
![descr](/url)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_image
      (image_description)
      (inline_link_destination))))

===============================================================================
Image: post precedence inline_link
===============================================================================
![x](y*)*

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_image
      (image_description)
      (inline_link_destination))))

===============================================================================
Image: post precedence full_reference_link
===============================================================================
![x][y*]*

-------------------------------------------------------------------------------

(document
  (paragraph
    (full_reference_image
      (image_description)
      (link_label))))

===============================================================================
Image: fallback
===============================================================================
![x](/u

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Emphasis
===============================================================================
With _em_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Strong
===============================================================================
With *strong* here

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Mixed emphasis and strong
===============================================================================
With _*strong* emphasis_ here
With *_emphasis_ strong* here

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content
        (strong
          (strong_begin)
          (content)
          (strong_end)))
      (emphasis_end))
    (strong
      (strong_begin)
      (content
        (emphasis
          (emphasis_begin)
          (content)
          (emphasis_end)))
      (strong_end))))

===============================================================================
Emphasis and strong two chars
===============================================================================
*bc a*
_bc a_

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis and strong with newlines
===============================================================================
*a
b*
_a
b_

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: three chars with spaces
===============================================================================
_a b c_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: two chars with spaces
===============================================================================
_a b_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: one char between
===============================================================================
_a_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: three chars with a newline
===============================================================================
_a
b c_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: three chars with a newline 2
===============================================================================
_ai
b c_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: three chars with two newlines
===============================================================================
_a
b
c_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: two chars with a newline
===============================================================================
_a
b_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: two chars with a newline 2
===============================================================================
_ab
cd_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: two chars with a newline 3
===============================================================================
_ab
x
cd_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: Shorter span
===============================================================================

{_*s*{_b_

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Superscript: Shorter span
===============================================================================

{^*s*{^b^

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: three chars with spaces
===============================================================================
^a b c^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: two chars with spaces
===============================================================================
^a b^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: one char between
===============================================================================
^a^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: three chars with a newline
===============================================================================
^a
b c^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: three chars with a newline 2
===============================================================================
^ai
b c^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: three chars with a two newlines
===============================================================================
^a
b
c^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: two chars with a newline
===============================================================================
^a
b^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: two chars with a newline 2
===============================================================================
^ab
cd^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Superscript: two chars with a newline 3
===============================================================================
^ab
x
cd^

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Emphasis: nested
===============================================================================
With __nested_ emphasis_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content
        (emphasis
          (emphasis_begin)
          (content)
          (emphasis_end)))
      (emphasis_end))))

===============================================================================
Emphasis: forced despite spaces
===============================================================================
{_yes_}
{_ yes _}
_yes _}
{_ yes_}

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Emphasis: simple nested
===============================================================================
__a_ b_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content
        (emphasis
          (emphasis_begin)
          (content)
          (emphasis_end)))
      (emphasis_end))))

===============================================================================
Emphasis: nested with spaces
===============================================================================
_a _b_ a_

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content
        (emphasis
          (emphasis_begin)
          (content)
          (emphasis_end)))
      (emphasis_end))))

===============================================================================
Emphasis: 2 not emphasis
===============================================================================
__ a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Emphasis: 3 not emphasis
===============================================================================
___ a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Emphasis: long not emphasis
===============================================================================
_________ a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Emphasis: begin 2 not emphasis
===============================================================================
__a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Emphasis: begin 3 not emphasis
===============================================================================
___a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Emphasis: begin long not emphasis
===============================================================================
_________a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Superscript: 2 not emphasis
===============================================================================
^^ a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Superscript: 3 not emphasis
===============================================================================
^^^ a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Superscript: long not emphasis
===============================================================================
^^^^^^^^^ a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Superscript: begin 2 not emphasis
===============================================================================
^^a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Superscript: begin 3 not emphasis
===============================================================================
^^^a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Superscript: begin long not emphasis
===============================================================================
^^^^^^^^^a

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Strong: forced despite spaces
===============================================================================
{*yes*}
*yes *}
{* yes*
{* yes *}

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))
    (strong
      (strong_begin)
      (content)
      (strong_end))
    (strong
      (strong_begin)
      (content)
      (strong_end))
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Subscript
===============================================================================
~sub~
{~many sub~}

-------------------------------------------------------------------------------

(document
  (paragraph
    (subscript
      (subscript_begin)
      (content)
      (subscript_end))
    (subscript
      (subscript_begin)
      (content)
      (subscript_end))))

===============================================================================
Superscript
===============================================================================
^sup^
{^many sup^}

-------------------------------------------------------------------------------

(document
  (paragraph
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))))

===============================================================================
Highlighted
===============================================================================
With {=mark=} here

-------------------------------------------------------------------------------

(document
  (paragraph
    (highlighted
      (highlighted_begin)
      (content)
      (highlighted_end))))

===============================================================================
Highlighted: Shorter span
===============================================================================

{=*s*{=b=}

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))
    (highlighted
      (highlighted_begin)
      (content)
      (highlighted_end))))

===============================================================================
Insert
===============================================================================
With {+insert+} here

-------------------------------------------------------------------------------

(document
  (paragraph
    (insert
      (insert_begin)
      (content)
      (insert_end))))

===============================================================================
Delete
===============================================================================
With {-delete-} here

-------------------------------------------------------------------------------

(document
  (paragraph
    (delete
      (delete_begin)
      (content)
      (delete_end))))

===============================================================================
Inline with newlines
===============================================================================
{=a
b=}
{+a
b+}
{-a
b-}
^a
b^
~a
b~

-------------------------------------------------------------------------------

(document
  (paragraph
    (highlighted
      (highlighted_begin)
      (content)
      (highlighted_end))
    (insert
      (insert_begin)
      (content)
      (insert_end))
    (delete
      (delete_begin)
      (content)
      (delete_end))
    (superscript
      (superscript_begin)
      (content)
      (superscript_end))
    (subscript
      (subscript_begin)
      (content)
      (subscript_end))))

===============================================================================
Hard line break
===============================================================================
With \
break

-------------------------------------------------------------------------------

(document
  (paragraph
    (hard_line_break)))

===============================================================================
Symbol: Allowed characters
===============================================================================
With :wi_nk-12: here

-------------------------------------------------------------------------------

(document
  (paragraph
    (symbol)))

===============================================================================
Symbol: No symbol characters
===============================================================================
With :win.k: here

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Link: inline
===============================================================================
With [link](/url)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Link: inline with nested emphasis
===============================================================================
With [link](1_2_3_4_5)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Link: with newline
===============================================================================
With [link
newline](/url)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Link: with url newline
===============================================================================
[text](url
here
go)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Link: begin
===============================================================================
[link](/url)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Link: collapsed reference link
===============================================================================
With [a reference][]

-------------------------------------------------------------------------------

(document
  (paragraph
    (collapsed_reference_link
      (link_text))))

===============================================================================
Link: full reference single
===============================================================================
With [a reference][ref]

-------------------------------------------------------------------------------

(document
  (paragraph
    (full_reference_link
      (link_text)
      (link_label))))

===============================================================================
Link: full reference
===============================================================================
With [a reference][ref]

-------------------------------------------------------------------------------

(document
  (paragraph
    (full_reference_link
      (link_text)
      (link_label))))

===============================================================================
Link: empty text inline
===============================================================================
[](y)

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Link: inline only one newline
===============================================================================
[x](y

)

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph))

===============================================================================
Link: inline precedence 1
===============================================================================
[x *](y)*

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Link: inline precedence 2
===============================================================================
*[*](y)

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Link: inline precedence 3
===============================================================================
*[x](y*)

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Link: full precedence 1
===============================================================================
[x *][y]*

-------------------------------------------------------------------------------

(document
  (paragraph
    (full_reference_link
      (link_text)
      (link_label))))

===============================================================================
Link: full precedence 2
===============================================================================
*[*][y]

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Link: full precedence 3
===============================================================================
*[x][y*]

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Link: collapsed precedence 1
===============================================================================
[x *][]*

-------------------------------------------------------------------------------

(document
  (paragraph
    (collapsed_reference_link
      (link_text))))

===============================================================================
Link: collapsed precedence 2
===============================================================================
*[*][]

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Link: collapsed precedence 3
===============================================================================
*[x][*]

-------------------------------------------------------------------------------

(document
  (paragraph
    (strong
      (strong_begin)
      (content)
      (strong_end))))

===============================================================================
Link: post precedence inline_link
===============================================================================
[x](y*)*

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))))

===============================================================================
Link: post precedence full_reference_link
===============================================================================
[x][y*]*

-------------------------------------------------------------------------------

(document
  (paragraph
    (full_reference_link
      (link_text)
      (link_label))))

===============================================================================
Link: fallback
===============================================================================
[x](/u

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Inline attribute: mixed
===============================================================================
text{.one .two #id author="with spaces"}

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_attribute
      (args
        (class)
        (class)
        (identifier)
        (key_value
          (key)
          (value))))))

===============================================================================
Inline attribute: casing
===============================================================================
text{.snake_case .cebab-case}

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_attribute
      (args
        (class)
        (class)))))

===============================================================================
Inline attribute: key casing
===============================================================================
text{snake_case=2 kebab-case=3}

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_attribute
      (args
        (key_value
          (key)
          (value))
        (key_value
          (key)
          (value))))))

===============================================================================
Inline attribute: surrounding spaces
===============================================================================
text{ .class }

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_attribute
      (args
        (class)))))

===============================================================================
Inline attribute: with newlines
===============================================================================
text{.one
.two
#three}

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_attribute
      (args
        (class)
        (class)
        (identifier)))))

===============================================================================
Inline attribute: with comment
===============================================================================
text{#ident % later we'll add a class %}

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_attribute
      (args
        (identifier)
        (comment
          (content))))))

===============================================================================
Inline attribute: comment
===============================================================================
text{%
some text here
%}

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_attribute
      (args
        (comment
          (content))))))

===============================================================================
Inline attribute: standalone comment
===============================================================================
Foo bar {% This is a comment, spanning
multiple lines %} baz.

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_comment
      (content))))

===============================================================================
Inline attribute: inline comment escape %
===============================================================================
Before {% escape \% %}

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_comment
      (content
        (backslash_escape)))))

===============================================================================
Inline attribute: span comment escape %
===============================================================================
[span]{% escape \% %}

-------------------------------------------------------------------------------

(document
  (paragraph
    (span
      (content)
      (inline_attribute
        (args
          (comment
            (content
              (backslash_escape))))))))

===============================================================================
Inline attribute: mixed comment escape %
===============================================================================
Before{#id % escape \% %}

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_attribute
      (args
        (identifier)
        (comment
          (content
            (backslash_escape)))))))

===============================================================================
Inline attribute: tight with on link
===============================================================================
1[x](u){k=v}2

-------------------------------------------------------------------------------

(document
  (paragraph
    (inline_link
      (link_text)
      (inline_link_destination))
    (inline_attribute
      (args
        (key_value
          (key)
          (value))))))

===============================================================================
Inline attribute: comment fallback
===============================================================================
Before{%

Before{% Some comment%

{%

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph)
  (paragraph))

===============================================================================
Span: With inline attributes
===============================================================================
One [two three]{.class
#id}

-------------------------------------------------------------------------------

(document
  (paragraph
    (span
      (content)
      (inline_attribute
        (args
          (class)
          (identifier))))))

===============================================================================
Span: Precedence
===============================================================================
_[_]{.c} Generates string then an inline attribute

[_]{.c_} The Djot playground doesn't handle this case properly either

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))
    (inline_attribute
      (args
        (class))))
  (paragraph
    (span
      (content)
      (inline_attribute
        (args
          (class))))))

===============================================================================
Span: Precedence prefer span
===============================================================================

[_]{.c}_

-------------------------------------------------------------------------------

(document
  (paragraph
    (span
      (content)
      (inline_attribute
        (args
          (class))))))

===============================================================================
Span: Precedence choose string with inline attribute
===============================================================================

_[_]{.c}

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))
    (inline_attribute
      (args
        (class)))))

===============================================================================
Span: Broken inline attribute
===============================================================================
[x]{.c

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Autolink: simple
===============================================================================
With </url> link

-------------------------------------------------------------------------------

(document
  (paragraph
    (autolink)))

===============================================================================
Autolink: fallback
===============================================================================
<

With </url

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph))

===============================================================================
Footnote reference: end of line
===============================================================================

Here's a ref.[^foo]

-------------------------------------------------------------------------------

(document
  (paragraph
    (footnote_reference
      (footnote_marker_begin)
      (reference_label)
      (footnote_marker_end))))

===============================================================================
Footnote reference: precedence, prefer emphasis
===============================================================================

_[^foo_]

-------------------------------------------------------------------------------

(document
  (paragraph
    (emphasis
      (emphasis_begin)
      (content)
      (emphasis_end))))

===============================================================================
Footnote reference: precedence, prefer footnote
===============================================================================

[^foo_]_

-------------------------------------------------------------------------------

(document
  (paragraph
    (footnote_reference
      (footnote_marker_begin)
      (reference_label)
      (footnote_marker_end))))

===============================================================================
Raw inline
===============================================================================
`<? php echo 'yoyo' ?>`{=html}

-------------------------------------------------------------------------------

(document
  (paragraph
    (raw_inline
      (raw_inline_marker_begin)
      (content)
      (raw_inline_marker_end)
      (raw_inline_attribute
        (language)))))

===============================================================================
Math: Simple
===============================================================================
$`1 + 2`

-------------------------------------------------------------------------------

(document
  (paragraph
    (math
      (math_marker)
      (math_marker_begin)
      (content)
      (math_marker_end))))

===============================================================================
Math: Close
===============================================================================
$`1 + 2

-------------------------------------------------------------------------------

(document
  (paragraph
    (math
      (math_marker)
      (math_marker_begin)
      (content)
      (math_marker_end))))

===============================================================================
Math: fallback
===============================================================================
$1 $a $$$$

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Emphasis: no space next
===============================================================================
_ x_

_x _

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph))

===============================================================================
Strong: no space next
===============================================================================
Avoid list: * x*

*x *

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph))

===============================================================================
Inline: standalone ()
===============================================================================
()

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Inline: space in inline link
===============================================================================
[x] (/u)

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Inline: broken {* (errors out)
===============================================================================

{*x

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Inline: broken list inline def (errors out)
===============================================================================

[x](

-------------------------------------------------------------------------------

(document
  (paragraph))

===============================================================================
Inline: broken things
===============================================================================
1 * 2

2 _ 1

~ x

{*x

{=x

{+x

{-x

^x

:x

[x

^

|

:

-

)

[^f

[x](

-------------------------------------------------------------------------------

(document
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph)
  (paragraph))
