jgm / djot

A light markup language
https://djot.net
MIT License
1.66k stars 43 forks source link

The definition item in a descrition list is always a paragraph #308

Open dimztimz opened 1 month ago

dimztimz commented 1 month ago

In commonmark and in djot we can have simple ordered list or lists where every item is paragraph. For example:

1. simple
2. list
3. test

1) list elements are paragraphs

2) test
3) test 2

The empty line in the second list forces each <li> to also contain <p>.

We do not have such choice for description lists.

: term, not a paragraph

  definition, always a paragraph

Emits the following HTML:

<dl>
<dt>term, not a paragraph</dt>
<dd>
<p>definition, always a paragraph</p>
</dd>
</dl>

How can we get rid of that <p>?

jgm commented 1 month ago
: term
  definition

: otherterm
  definition
dimztimz commented 1 month ago
: term
  definition

: otherterm
  definition

That does not seem to work in the online version of djot. It puts the term and the definition under <dt> while <dd> is empty.

<dl>
<dt>term
definition</dt>
<dd>
</dd>
<dt>otherterm
definition</dt>
<dd>
</dd>
</dl>
jgm commented 1 month ago

Sorry, my mistake!

jgm commented 1 month ago

Perhaps we need to modify (or reinterpret) the rule for tight lists for definition lists. Currently these are being counted as "loose" lists because of the blank line after the term. But since that blank line is required, there is no way to make a tight definition list. The obvious thing would be to disregard that first blank in determining whether the list is tight.

Omikhleia commented 1 month ago

But was is the real problem of having a <p> for something that is a paragraph by nature? (Or it isn't? Please explain the rationale to get rid of it, and the implications.)

Omikhleia commented 1 month ago

(N.B. It does seem similar to https://github.com/jgm/djot/issues/138#issuecomment-1326702446 -- though on a purely typographic angle, i.e. notwithstanding HTML idiosyncrasies, I don't really understand the key difference between tight and loose lists, except it might have to do with paragraph leading.)