<dfn>, the define element

I searched around, and didn’t see anyone mention or think about the define element (<dfn>).

I’m not in this community, and don’t have time to really elaborate. Is it being thought about?

4 Likes

(No response in 5.5 years. Bummer.)

This has been a long-standing frustration I’ve had with the Markdown spec(s) over the years. You can always fall back to raw HTML (Markdown allows it), and that’s what I’ve done in the past when something else (e.g., a table) wouldn’t do.

It’s been ages since I thought about coming up with syntax for this, but I think it was something like:

This is a paragraph doing totally normal paragraph-y things.

  :: Markdown

    Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber created Markdown in 2004 as an easy-to-read markup language.

    Markdown is widely used for blogging, instant messaging, and large language models, and also used elsewhere in online forums, collaborative software, documentation pages, and readme files.

This example uses a 2-space indent. The :: annotates a definition term (dt), while the double-indented (4-spaces) text is the definition (dd). Just like list items, continued indentation will continue the definition (dd) block.

I’ve not discovered any meaningful discussion of definition lists in Markdown before (but it has also been 10+ years since I’ve looked), so I’ve not based this syntax on anything other than (a) I don’t think it’s currently used for anything else in Commonmark, and (b) it feels straightforward to write (to me).

(Having said that, I think I recall MkDocs using a similar syntax for admonitions, so maybe this syntax isn’t great. That said, MkDocs 1.x hasn’t been updated in a while, so maybe the syntax is up-for-grabs again?)

The original question was about the dfn element. You are talking about dl/dt/dd (definition lists). There is plenty of discussion of definition lists in Markdown, and many implementations have supported them going back to the mid-2000s. For example, pandoc uses a syntax based on that of the early PHP Markdown Extra. Pandoc even supports this an an optional extension to commonmark. Many other implementations, e.g. kramdown, support the same syntax.

3 Likes

Ah, you’re right. I confused <dfn> for <dl>. My bad.

In Generic text spans [foo] with special cases I entertained the idea of special-casing – by current CM spec terms: – link targets to support more of HTML inline elements. To get an actual <a> link, the first parameter within parentheses () of inline links or after the colon : in reference link definitions would then need to be enclosed in angular brackets <> to be considered an URL and therefore trigger link output behavior.
For local anchored links to ids, this would look like [text](<#ID>)<a href="#ID">text</a>. This enables repurposing [term](#ID) for definitions, turning it into <dfn id="ID">term</dfn>. The ID would be optional: [term](#)<dfn>term</dfn>.
As oh so often, life came in the way and I didn’t pursue this project any further.

Earlier, in Em/strong vs. i/b or cite/dfn etc, I considered to treat asterisk * and underscore _ emphasis distinctly and also special-case quadruple repetitions thereof. This could be used for other semantic elements or for presentational ones (by classic HTML terms), e.g.:

  • *em*, **strong**, ****i****, ********b********,
    _cite_, __dfn__, …
  • *em*, **strong**, ****dfn****,
    _i_, __b__, ____u____

In the same post, I also suggested that Mediawiki syntax could be a precedent. In Wikipedia, defined terms, by convention, are put between triple apostrophes on both sides: '''dfn''', although WP does not generate <dfn> but <strong> elements from that; and <em> from double apostrophes. I would couple it with 'q' quotes and ''cite'' reference titles.

PS: The requirement for angular brackets <> would not need to be as strong as worded above. A slash / or well-known scheme identifier followed by a colon : should also suffice.

I’ve reason to explicitly want this: