On the <dl> (2021)

49 points by runxiyu 23 hours ago on lobsters | 13 comments

radio | 18 hours ago

It's sad that Markdown doesn't have description lists.

apropos | 13 hours ago

Pandoc flavoured Markdown supports description lists with at least two syntaxes.

Most implementations don't, though, true. The Typst typesetting system / markup language, on the other hand, gives first-class syntax to description lists as / term: description, which I think slots in really nicely with their - bulleted lists and + auto-numbered lists...

fiatjaf | 5 hours ago

https://github.com/typst/typst This looks good.

Is Typst just an app or is it a standard that aims to be implemented in multiple places?

trenchant | 3 hours ago

I don't think it aims to be implemented in multiple places, but the one implementation can already render to both an HTML page or a PDF, live in the browser, and its implementation supposedly makes new output formats easy to add. So I think the goal is to stay to the one implementation but be flexible enough to do whatever you'd want to accomplish with a separate implementation.

[OP] runxiyu | 17 hours ago

Some implementations (notably, iirc, Hugo, Pandoc, and GFM?) support

dt
: dd

dt
: dd

Markdown has everything HTML has. It is a superset of HTML.

rebane2001 | 6 hours ago

Depends on where you use it. Here on Lobsters, for example, I can't use HTML in Markdown.

  • I can
  • make lists
    • like this

but I can't use the <dl> element.

roryokane | 24 minutes ago

Specifically, you can’t use it because Lobsters’s Markdown renderer escapes all HTML tags:

<dl><dt>term</dt><dd>detail</dd></dl>

The renderer even escapes HTML tags that it is willing to output when you use the dedicated Markdown syntax:

<ul><li>a list</li></ul>

It behaves this way because Lobsters uses the Commonmarker Ruby gem and doesn’t override the unsafe option’s default of false. Lobsters does set the escape option to true, but that just makes HTML tags get printed instead of swallowed.

I once proposed that Lobsters allow comments to use more HTML elements (such as <dl>). My proposed method was to allow the Markdown renderer to pass through HTML, then sanitize the rendered HTML using another Ruby gem. That was in 2015, long ago enough that Lobsters used a different library for Markdown rendering. The Lobsters maintainer at the time, jcs, wrote that the tradeoffs against security concerns did not seem worth it.

whjms | 6 hours ago

Markdown does not have convenient syntax for <dl> - this is the commonly-used connotation of "Markdown has X".

fiatjaf | 5 hours ago

https://www.djot.net/ supports description lists (and, most importantly, Djot is not a superset of HTML and can be used outside of a bloated HTML-capable browser).

adam_d_ruppe | 5 hours ago

You can have multiple <dt>s per entry too. You can use this for things like synonyms in a dictionary list. When styling them in css you probably want to familiarize yourself with the adjacent sibling selector.

see: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dt

technomancy | 18 hours ago

Gotta be one of my top five elements of all time.

whjms | 6 hours ago

It's definitely up there with <details>. I wish we had more interactive elements.