Open clarfonthey opened 1 year ago
related issue: https://github.com/jgm/djot/issues/51
So, I did see that issue when searching but didn't read closely enough; it does seem similar, but I'll leave this here for now since it does provide a separate view on how abbreviations are particularly useful.
One particular feature that I've used extensively in my own markup, but haven't really seen a proper implementation of, is abbreviations. In HTML, these are emitted with an
<abbr>
tag and a title attribute, but I feel like they could be useful outside that context as well.In particular, the use case I'm thinking of is the bog-standard purpose of abbreviations, where you can add a tooltip to a word and include its definition inline. I also have in the past used a
data-title
attribute to allow full markup in these titles (deferring to the regulartitle
attribute without markup in cases where JS is not available), so they can include things like links.A lot of the common extensions for abbreviations in markup parsers involves automatically adding abbreviations based upon references, which isn't the kind of thing I'm talking about here. The kind of extension I'd be considering here would be more akin to "inline footnotes," where instead of just emitting a link to a footnote, you'd be able to see the text of the footnote inline.
I'm going to offer a potential solution here, but I'm definitely open to whatever one gets used; I just think this would be a good addition to the language.
My solution:
Footnotes can be used as the reference for a link, in which case they're treated as an inline footnote or abbreviation. Instead of emitting a simple link to the footnote, the link is used as the text for the abbreviation, and the title of the abbreviation is replaced with the text content of the first block element in the footnote. If the footnote contains more than a simple paragraph, a regular footnote link is added to link to a full footnote, otherwise no footnote is generated.
This allows a pretty standard-HTML interpretation of abbreviations, but allows for extensions which include more markup while still providing that fallback.