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.
The list is tight if there is no blank line between
the term and the first definition, otherwise loose.
$ comrak -e description-lists -t commonmark -t xml
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><textxml:space="preserve">apple</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">red fruit</text></paragraph></description_details></description_item><description_item><description_term><paragraph><textxml:space="preserve">orange</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">orange fruit</text></paragraph></description_details></description_item></description_list></document>
Loose:
$ comrak -e description-lists -t commonmark -t xml
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><textxml:space="preserve">apple</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">red fruit</text></paragraph></description_details></description_item><description_item><description_term><paragraph><textxml:space="preserve">orange</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">orange fruit</text></paragraph></description_details></description_item></description_list></document>
Indented marker:
$ comrak -e description-lists -t commonmark -t xml
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><textxml:space="preserve">apple</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">red fruit</text></paragraph></description_details></description_item><description_item><description_term><paragraph><textxml:space="preserve">orange</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">orange fruit</text></paragraph></description_details></description_item></description_list></document>
$ comrak -e description-lists -t commonmark -t xml
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><textxml:space="preserve">apple</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">red fruit</text></paragraph></description_details></description_item><description_item><description_term><paragraph><textxml:space="preserve">orange</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">orange fruit</text></paragraph></description_details></description_item></description_list></document>
Multiple blocks in a definition:
$ comrak -e description-lists -t commonmark -t xml
*apple*: red fruit
contains seeds,
crisp, pleasant to taste
*orange*: orange fruit
{ orange code block }
> orange block quote
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><preclass="syntax-highlighting"><code><spanclass="text plain">{ orange code block }
</span></code></pre><blockquote><p>orange block quote</p></blockquote></dd></dl>
*apple*: red fruit
contains seeds,
crisp, pleasant to taste
*orange*: orange fruit
{ orange code block }
> orange block quote
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><emph><textxml:space="preserve">apple</text></emph></paragraph></description_term><description_details><paragraph><textxml:space="preserve">red fruit</text></paragraph><paragraph><textxml:space="preserve">contains seeds,</text><softbreak/><textxml:space="preserve">crisp, pleasant to taste</text></paragraph></description_details></description_item><description_item><description_term><paragraph><emph><textxml:space="preserve">orange</text></emph></paragraph></description_term><description_details><paragraph><textxml:space="preserve">orange fruit</text></paragraph><code_blockxml:space="preserve">{ orange code block }
</code_block><block_quote><paragraph><textxml:space="preserve">orange block quote</text></paragraph></block_quote></description_details></description_item></description_list></document>
Nested lists:
$ comrak -e description-lists -t commonmark -t xml
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><textxml:space="preserve">term</text></paragraph></description_term><description_details><listtype="ordered"start="1"delim="period"tight="false"><item><paragraph><textxml:space="preserve">Para one</text></paragraph><paragraph><textxml:space="preserve">Para two</text></paragraph></item></list></description_details></description_item></description_list></document>
Multiple definitions, tight:
$ comrak -e description-lists -t commonmark -t xml
apple
: red fruit
: computer company
orange
: orange fruit
: telecom company
apple
: red fruit
: computer
company
orange
: orange
fruit
: telecom company
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><textxml:space="preserve">apple</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">red fruit</text></paragraph></description_details></description_item><description_item><description_details><paragraph><textxml:space="preserve">computer</text><softbreak/><textxml:space="preserve">company</text></paragraph></description_details></description_item><description_item><description_term><paragraph><textxml:space="preserve">orange</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">orange</text><softbreak/><textxml:space="preserve">fruit</text></paragraph></description_details></description_item><description_item><description_details><paragraph><textxml:space="preserve">telecom company</text></paragraph></description_details></description_item></description_list></document>
~ may be used as a marker instead of ::
$ comrak -e description-lists -t commonmark -t xml
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><textxml:space="preserve">apple</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">red fruit</text></paragraph></description_details></description_item><description_item><description_term><paragraph><textxml:space="preserve">orange</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">orange fruit</text></paragraph></description_details></description_item></description_list></document>
Definition terms may span multiple lines:
$ comrak -e description-lists -t commonmark -t xml
a
b\c
: foo
a
b
c
foo
<dl><dt>a
b<br />
c</dt><dd><p>foo</p></dd></dl>
a
b\c
: foo
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><description_list><description_item><description_term><paragraph><textxml:space="preserve">a</text><softbreak/><textxml:space="preserve">b</text><linebreak/><textxml:space="preserve">c</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">foo</text></paragraph></description_details></description_item></description_list></document>
<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdocument SYSTEM "CommonMark.dtd"><documentxmlns="http://commonmark.org/xml/1.0"><paragraph><textxml:space="preserve">Foo</text></paragraph><description_list><description_item><description_term><paragraph><textxml:space="preserve">bar</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">baz</text></paragraph></description_details></description_item><description_item><description_term><paragraph><textxml:space="preserve">bim</text></paragraph></description_term><description_details><paragraph><textxml:space="preserve">bor</text></paragraph></description_details></description_item></description_list></document>