Definition list output #83

Closed
opened 2026-01-29 14:25:33 +00:00 by claunia · 6 comments
Owner

Originally created by @daveaglick on GitHub (Jan 9, 2017).

Just curious what the thought is behind the definition list syntax borrowed from PHP Markdown doesn't output the semantic <dl><dt></dt><dd></dd></dl> HTML markup and instead outputs a custom set of markup inside a <p> element? Not sure either approach is better than the other, but the former is easier to style with CSS if nothing else (and libraries like Bootstrap already have element styles to support it).

Originally created by @daveaglick on GitHub (Jan 9, 2017). Just curious what the thought is behind the definition list syntax borrowed from PHP Markdown doesn't output the semantic `<dl><dt></dt><dd></dd></dl>` HTML markup and instead outputs a custom set of markup inside a `<p>` element? Not sure either approach is better than the other, but the former is easier to style with CSS if nothing else (and libraries like Bootstrap already have element styles to support it).
claunia added the question label 2026-01-29 14:25:33 +00:00
Author
Owner

@xoofx commented on GitHub (Jan 9, 2017):

Not sure to understand, but checking babelmark, everything seems fine from there no?

@xoofx commented on GitHub (Jan 9, 2017): Not sure to understand, but checking [babelmark](https://babelmark.github.io/?text=Apple%0A%3A+++Pomaceous+fruit+of+plants+of+the+genus+Malus+in+%0Athe+family+Rosaceae.%0A%0AOrange%0A%3A+++The+fruit+of+an+evergreen+tree+of+the+genus+Citrus.), everything seems fine from there no?
Author
Owner

@xoofx commented on GitHub (Jan 9, 2017):

ha, maybe it is because it's borrowed from "PHP Markdown Extra" not "PHP Markdown"...

@xoofx commented on GitHub (Jan 9, 2017): ha, maybe it is because it's borrowed from "PHP Markdown Extra" not "PHP Markdown"...
Author
Owner

@daveaglick commented on GitHub (Jan 9, 2017):

Sorry, probably wasn't totally clear. Given the following Markdown:

Apple
:   Pomaceous fruit of plants of the genus Malus in 
the family Rosaceae.

Orange
:   The fruit of an evergreen tree of the genus Citrus.

I'm curious why this gets generated:

<p>
  Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
</p>
<p>
  Orange : The fruit of an evergreen tree of the genus Citrus.
</p>

Instead of this:

<dl>
  <dt>
    Apple
  </dt>
  <dd>
    Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
  </dd>
  <dt>
    Orange
  </dt>
  <dd>
    The fruit of an evergreen tree of the genus Citrus.
  </dd>
</dl>

To be honest, I'm really surprised at how many Markdown processors do the former from the babelmark link - it seems interesting to use an arbitrary output that injects extra characters (like that : to separate the term from the definition) when HTML elements for this exist. Wondering if there is some reasoning I'm not realizing (like lack of browser support for the <dl> family of elements)...

@daveaglick commented on GitHub (Jan 9, 2017): Sorry, probably wasn't totally clear. Given the following Markdown: ``` Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange : The fruit of an evergreen tree of the genus Citrus. ``` I'm curious why this gets generated: ``` <p> Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. </p> <p> Orange : The fruit of an evergreen tree of the genus Citrus. </p> ``` Instead of this: ``` <dl> <dt> Apple </dt> <dd> Pomaceous fruit of plants of the genus Malus in the family Rosaceae. </dd> <dt> Orange </dt> <dd> The fruit of an evergreen tree of the genus Citrus. </dd> </dl> ``` To be honest, I'm really surprised at how many Markdown processors do the former from the babelmark link - it seems interesting to use an arbitrary output that injects extra characters (like that `:` to separate the term from the definition) when HTML elements for this exist. Wondering if there is some reasoning I'm not realizing (like lack of browser support for the `<dl>` family of elements)...
Author
Owner

@xoofx commented on GitHub (Jan 9, 2017):

but the <p>...</p> output is for plain markdig (CommonMark only), but markdig (advanced) generates the correct output right? (check again babelmark above).

The definition list is not standardized by CommonMark. The implementation in markdig is trying to mimic the behavior of PHP Mardown Extra, but there is no guarantee that we will have the same output for all circumstances... But as you noticed, many Markdown implementations don't even have this implemented...

@xoofx commented on GitHub (Jan 9, 2017): but the `<p>...</p>` output is for plain markdig (CommonMark only), but `markdig (advanced)` generates the correct output right? (check again babelmark above). The definition list is not standardized by CommonMark. The implementation in markdig is trying to mimic the behavior of PHP Mardown Extra, but there is no guarantee that we will have the same output for all circumstances... But as you noticed, many Markdown implementations don't even have this implemented...
Author
Owner

@daveaglick commented on GitHub (Jan 9, 2017):

Interesting - I'll have to do some research and make sure I'm not screwing something up. As far as I can tell, I'm getting the <p> output even with "advanced+bootstrap" set as the extension string.

@daveaglick commented on GitHub (Jan 9, 2017): Interesting - I'll have to do some research and make sure I'm not screwing something up. As far as I can tell, I'm getting the `<p>` output even with "advanced+bootstrap" set as the extension string.
Author
Owner

@daveaglick commented on GitHub (Jan 9, 2017):

All is well - it took me a little while to realize that there needs to be extra whitespace between the : and the description for the list formatting to kick in. Turns out I was just outputting normal Markdown without triggering the description list handling.

@daveaglick commented on GitHub (Jan 9, 2017): All is well - it took me a little while to realize that there needs to be extra whitespace between the `:` and the description for the list formatting to kick in. Turns out I was just outputting normal Markdown without triggering the description list handling.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#83