Is it possible to attach attributes to a definition list item?
I wasn’t able to do this in live playground neither for terms nor for definitions.
{.red}
: term
definition
parses as
doc
definition_list class="red"
definition_list_item
term
str text="term"
definition
para
str text="definition"
and
: term
{.red}
definition
parses as
doc
definition_list
definition_list_item
term
str text="term"
definition
para class="red"
str text="definition"
(note that class is attached to para, not to definition).
Possibly related to #308.
This is basically the same as #250, no?
Yeah, probably. Sorry, I searched for definition, and #250 doesn’t mention it.
I am struggling a bit, if one thinks about multiple dt/dd and this approach:
{.red}
: term
: term2
definition
definition2
// Something else
This is technically possible to render als multiple, even though not in specs yet. But if it was, the attached .red, would it apply to the outer dd? or the specific terms?
I guess the simple answer would be: outer <dl>.
Multiple terms/definitions example:
{.vocabulary}
: color
{.american}
: colour
{.british}
The visual property of objects.
{.primary}
Used in art and design.
{.secondary}
Would produce:
<dl class="vocabulary">
<dt class="american">color</dt>
<dt class="british">colour</dt>
<dd class="primary">
<p>The visual property of objects.</p>
</dd>
<dd class="secondary">
<p>Used in art and design.</p>
</dd>
</dl>
It all seems to work fine, made a PR here to showcase it: https://github.com/php-collective/djot-php/pull/34
The approach in #250 would allow adding an attribute to a definition list item (including both the term and the definition):
:{.class} term
definition
An attribute could be added to the term this way (not qua term but just qua inline sequence):
: [term]{.class}
definition
At this point there are no plans to support multiple terms or definitions. HTML does have these, but they don't make sense in a lot of other formats (e.g. LaTeX description lists), and I don't think they're really necessary.
One can do
: term1\
term2
definition
and
: term
a) definition 1
b) definition 2
like in a dictionary.
For idempotent parsing and clean round-trip with html this can be useful to have. But either way works
For multiple dt I would prefer the : start Allows multiple like if needed