Similarly to Markdown ULs and OLs, the DL format is defined by grouping its items.
A DT is indicated by a line starting with a :
. A DD is indicated by a line starting with a ::
. As with UL/OL, you can linebreak within a block by indenting the subsequent lines, and a block can contain multiple paragraphs as long as you indent. Two blank lines, or a single blank line followed by an unindented line, ends the list.
:term
::definition
:another term
::a longer definition
stretching over two lines
:a third term
::an even longer definition
This definition has two paragraphs!
The DTs and DDs serve equally well to define the DL. Just like in HTML, you can have as many DTs and DDs in a sequence as you want, and you can even start a list with a DD or end with a DT (though that's not semantically meaningful...).
There are several shortcut forms to this syntax.
You can supply the DD on the same line as the DT if you end the DT with another :
:
:compact DL: A DL that puts its DTs and DDs on the same line.
:long-form DL: One that puts its DDs on the following line.
You can also stack multiple DTs onto a single line by just concatenating them, wrapping each in :
s on either side and separating them with whitespace:
:apple: :orange: kinds of fruit
:tomato: :zucchini: kinds of vegetables
Hm, those shortcut syntaxes are a little confusing. Maybe instead, you're just allowed to stack DT/DDs into a single line as normal?
:compact DL ::A DL that puts its DTs and DDs on the same line
:long-form DL ::One that puts its DDs on the following line
:apple :orange ::kinds of fruit
:tomato :zucchini ::kinds of vegetables
This syntax leads directly from the long-form syntax, and so is probably easier to understand.
There's also a big issue with stacking dts/dds on a single line: I had thought that any literal use of the :
characters could just be escaped, but it really can't be, because it's part of common CSS syntaxes (pseudo-classes, pseudo-elements, example property: values
lines).
Couple ways to address this:
- Drop the stacked syntaxes, so DTs and DDs are only one per line.
- Very carefully track when elements are opened/closed, so only top-level
:
characters are acted on. We'd need to be careful about the way that some of the other markup shortcuts are done - I think Markdown processing happens before any of the linking shortcuts are turned into elements. - Use a more exotic character for lists (but this doesn't deal with the problem forever, and if some char is used for non-CSS stuff, it'll have the same problems).
- ???
Hmm, on further consideration, I guess that just escaping the : is fine (your option 4). It's a little confusing, but it's also kinda rare.
It's less bad for UL/OL, because you only have to be on the watch for lines starting with the metacharacter.