## Definition lists

Based on https://github.com/jgm/commonmark-hs/blob/e3747fd282c806cd2f8e83226e85f1b83ee889c3/commonmark-extensions/test/definition_lists.md

The term is given on a line by itself, followed by
one or more definitions. Each definition must begin
with `:` (after 0-2 spaces); subsequent lines must
be indented unless they are lazy paragraph
continuations.

Commonmark-HS allows definition lists to use `~`.
We can't do that, because we already use `~` for strikethrough.

The list is tight if there is no blank line between
the term and the first definition, otherwise loose.

```````````````````````````````` example
apple
:   red fruit

orange
:   orange fruit
.
<dl>
<dt>apple</dt>
<dd>red fruit</dd>
<dt>orange</dt>
<dd>orange fruit</dd>
</dl>
````````````````````````````````

Loose:

```````````````````````````````` example
apple

:   red fruit

orange

:   orange fruit
.
<dl>
<dt>apple</dt>
<dd>
<p>red fruit</p>
</dd>
<dt>orange</dt>
<dd>
<p>orange fruit</p>
</dd>
</dl>
````````````````````````````````

Also loose:

```````````````````````````````` example
apple

:   red fruit
.
<dl>
<dt>apple</dt>
<dd>
<p>red fruit</p>
</dd>
</dl>
````````````````````````````````

Indented marker:

```````````````````````````````` example
apple
  : red fruit

orange
  : orange fruit
.
<dl>
<dt>apple</dt>
<dd>red fruit</dd>
<dt>orange</dt>
<dd>orange fruit</dd>
</dl>
````````````````````````````````

```````````````````````````````` example
apple

 : red fruit

orange

 : orange fruit
.
<dl>
<dt>apple</dt>
<dd>
<p>red fruit</p>
</dd>
<dt>orange</dt>
<dd>
<p>orange fruit</p>
</dd>
</dl>
````````````````````````````````

Multiple blocks in a definition:

```````````````````````````````` example
*apple*

:   red fruit

    contains seeds,
    crisp, pleasant to taste

*orange*

:   orange fruit

        { orange code block }

    > orange block quote
.
<dl>
<dt><em>apple</em></dt>
<dd>
<p>red fruit</p>
<p>contains seeds,
crisp, pleasant to taste</p>
</dd>
<dt><em>orange</em></dt>
<dd>
<p>orange fruit</p>
<pre><code>{ orange code block }
</code></pre>
<blockquote>
<p>orange block quote</p>
</blockquote>
</dd>
</dl>
````````````````````````````````

Nested lists:

```````````````````````````````` example
term

:   1. Para one

       Para two
.
<dl>
<dt>term</dt>
<dd>
<ol>
<li><p>Para one</p>
<p>Para two</p></li>
</ol>
</dd>
</dl>
````````````````````````````````

Multiple definitions, tight:

```````````````````````````````` example
apple
:   red fruit
:   computer company

orange
:   orange fruit
:   telecom company
.
<dl>
<dt>apple</dt>
<dd>red fruit</dd>
<dd>computer company</dd>
<dt>orange</dt>
<dd>orange fruit</dd>
<dd>telecom company</dd>
</dl>
````````````````````````````````

Multiple definitions, loose:

```````````````````````````````` example
apple

:   red fruit

:   computer company

orange

:   orange fruit
:   telecom company
.
<dl>
<dt>apple</dt>
<dd>
<p>red fruit</p>
</dd>
<dd>
<p>computer company</p>
</dd>
<dt>orange</dt>
<dd>
<p>orange fruit</p>
</dd>
<dd>
<p>telecom company</p>
</dd>
</dl>
````````````````````````````````

Lazy line continuations:

```````````````````````````````` example
apple

:   red fruit

:   computer
company

orange

:   orange
fruit
:   telecom company
.
<dl>
<dt>apple</dt>
<dd>
<p>red fruit</p>
</dd>
<dd>
<p>computer
company</p>
</dd>
<dt>orange</dt>
<dd>
<p>orange
fruit</p>
</dd>
<dd>
<p>telecom company</p>
</dd>
</dl>
````````````````````````````````

A lazy continuation may start with a `:`, if it has enough indent.

```````````````````````````````` example
apple
   : > computer company
     : red fruit

orange
   : > telecom company
   : orange fruit

chili's
   : > restaurant company
 : spicy fruit
.
<dl>
<dt>apple</dt>
<dd><blockquote>
<p>computer company
: red fruit</p>
</blockquote>
</dd>
<dt>orange</dt>
<dd><blockquote>
<p>telecom company</p>
</blockquote>
</dd>
<dd>orange fruit</dd>
<dt>chili's</dt>
<dd><blockquote>
<p>restaurant company</p>
</blockquote>
</dd>
<dd>spicy fruit</dd>
</dl>
````````````````````````````````

It may not, however, lazily act as a definition in a list.

```````````````````````````````` example
> cherry
> : keyboard company
> pomegranate
: tart fruit
.
<blockquote>
<dl>
<dt>cherry</dt>
<dd>keyboard company
pomegranate
: tart fruit</dd>
</dl>
</blockquote>
````````````````````````````````

Definition terms may span multiple lines:

```````````````````````````````` example
a
b\
c

:   foo
.
<dl>
<dt>a
b<br />
c</dt>
<dd>
<p>foo</p>
</dd>
</dl>
````````````````````````````````

Definition list with preceding paragraph
(<https://github.com/jgm/commonmark-hs/issues/35>):

```````````````````````````````` example
Foo

bar
:   baz

bim
:   bor
.
<p>Foo</p>
<dl>
<dt>bar</dt>
<dd>baz</dd>
<dt>bim</dt>
<dd>bor</dd>
</dl>
````````````````````````````````

Definition list followed by paragraph.

```````````````````````````````` example
bar
:   baz

bim
:   bor

Bloze
.
<dl>
<dt>bar</dt>
<dd>baz</dd>
<dt>bim</dt>
<dd>bor</dd>
</dl>
<p>Bloze</p>
````````````````````````````````

The total indentation for a definition list cannot exceed four.
This means you can't have one start with four spaces.

```````````````````````````````` example
bar
    :baz

Bloze
.
<p>bar
:baz</p>
<p>Bloze</p>
````````````````````````````````

You can follow one with four spaces,
because it'll "eat" the three spaces after it.

```````````````````````````````` example
bar
:    baz

Bloze
.
<dl>
<dt>bar</dt>
<dd>baz</dd>
</dl>
<p>Bloze</p>
````````````````````````````````

To use an indented code block inside of a definition,
you need to have five spaces of indentation after the colon.

```````````````````````````````` example
bar
:       baz

bar
 :      baz

bar
  :     baz

bar
   :    baz

bar
    :   baz
.
<dl>
<dt>bar</dt>
<dd>
<pre><code>  baz
</code></pre>
</dd>
<dt>bar</dt>
<dd>
<pre><code> baz
</code></pre>
</dd>
<dt>bar</dt>
<dd>
<pre><code>baz
</code></pre>
</dd>
<dt>bar</dt>
<dd>baz</dd>
</dl>
<p>bar
:   baz</p>
````````````````````````````````


Because of the way it eats indentation after the colon, the number of
spaces you need for indented code blocks on subsequent lines depends on
the indentation of the earlier block.

```````````````````````````````` example
*orange*

:   orange fruit

        { orange code block }

  > orange block quote

*orange*

:     orange fruit

        { orange code block }

  > orange block quote
.
<dl>
<dt><em>orange</em></dt>
<dd>
<p>orange fruit</p>
<pre><code>{ orange code block }
</code></pre>
</dd>
</dl>
<blockquote>
<p>orange block quote</p>
</blockquote>
<dl>
<dt><em>orange</em></dt>
<dd>
<pre><code>orange fruit

  { orange code block }
</code></pre>
<blockquote>
<p>orange block quote</p>
</blockquote>
</dd>
</dl>
````````````````````````````````

Definition titles can't be tables.

```````````````````````````````` example
Test|Table
----|-----
: first
.
<table><thead><tr><th>Test</th><th>Table</th></tr></thead><tbody>
<tr><td>: first</td><td></td></tr>
</tbody>
</table>
````````````````````````````````

```````````````````````````````` example
first
: second

Test|Table
----|-----
: fourth
.
<dl>
<dt>first</dt>
<dd>second</dd>
</dl>
<table><thead><tr><th>Test</th><th>Table</th></tr></thead><tbody>
<tr><td>: fourth</td><td></td></tr>
</tbody>
</table>
````````````````````````````````


Definition titles can't be headers

```````````````````````````````` example
My section
==========
: first
.
<h1>My section</h1>
<p>: first</p>
````````````````````````````````

```````````````````````````````` example
first
: second

My section
==========
: fourth
.
<dl>
<dt>first</dt>
<dd>second</dd>
</dl>
<h1>My section</h1>
<p>: fourth</p>
````````````````````````````````

```````````````````````````````` example
## My subsection
: first
.
<h2>My subsection</h2>
<p>: first</p>
````````````````````````````````

```````````````````````````````` example
first
: second

## My subsection
: fourth
.
<dl>
<dt>first</dt>
<dd>second</dd>
</dl>
<h2>My subsection</h2>
<p>: fourth</p>
````````````````````````````````


Definition list titles can't be block quotes

```````````````````````````````` example
> first
: second
.
<blockquote>
<p>first
: second</p>
</blockquote>
````````````````````````````````


Definition titles can't end with hard line breaks.

```````````````````````````````` example
first\
: second

third  
: fourth
.
<dl>
<dt>first\</dt>
<dd>second</dd>
<dt>third</dt>
<dd>fourth</dd>
</dl>
````````````````````````````````


Definition titles can't be HTML blocks, but inline's fine.

```````````````````````````````` example
<div>first</div>
: second

first
: second
<div>third</div>
: fourth
.
<div>first</div>
: second
<dl>
<dt>first</dt>
<dd>second</dd>
</dl>
<div>third</div>
: fourth
````````````````````````````````

```````````````````````````````` example
<span>first</span>
: second

third
: fourth

<span>fifth</span>
: sixth
.
<dl>
<dt><span>first</span></dt>
<dd>second</dd>
<dt>third</dt>
<dd>fourth</dd>
<dt><span>fifth</span></dt>
<dd>sixth</dd>
</dl>
````````````````````````````````

Nested definition lists:
(<https://github.com/pulldown-cmark/pulldown-cmark/issues/973>):

```````````````````````````````` example
level one
: l1
    level two
    : l2
        level three
        : l3

level one
: l1
.
<dl>
<dt>level one</dt>
<dd>
<dl>
<dt>l1
level two</dt>
<dd>
<dl>
<dt>l2
level three</dt>
<dd>l3</dd>
</dl>
</dd>
</dl>
</dd>
<dt>level one</dt>
<dd>l1</dd>
</dl>
````````````````````````````````
