Abbr tags (tooltips) using link syntax

I noticed that there is a great opportunity for the spec to support the abbr tag. While a thread in the past has asked to implement that in a way similar to Markdown Extra where you define the abbr tooltip after the text, that seems unwieldy since it would mark up EVERY mention of the keyword.

A better implementation would, I believe, be supported in a way that’s already part of the spec: the link syntax, minus the link.

[Text]("Tooltip text")

would become

<abbr title="Tooltip text">Text</abbr>

This works fluidly with the current spec since the part inside the quotations in the regular link syntax provides the title for the link. Since the only default function of the abbr tag is to provide a tooltip, it is essentially a link without a URL… which is exactly what this CommonMark syntax is. So it is a logical fit that naturally follows from the link syntax.

4 Likes

hmmm this could be interesting if used in context with links

e.g.

Looks like that works already in this forum’s parser

[Google]( www.google.com "This is a search engine website" )

Google

Ah, even with the tooltip description, it seems to work on hover:

[Google]( "This is a search engine website" )

[Google]( “This is a search engine website” )

Though, I assume you don’t want such form to be seen as a link, but as an abbr tag instead

2 Likes

would be neat, but overloading the syntax is generally bad

I’ve recategorised this topic to “extensions” since the goal of CommonMark core is not to introduce new features.

For reference, see the Markdown Extra abbreviation syntax is discussed here, but as @PeckishSnake mentioned, it applies to every instance of the abbreviation, leaving no option to exclude particular instances from being marked up. So I think a case-by-case abbrievation syntax would be useful, and I personally like the proposal here.

I believe it helps graceful fallback, hence backwards compatibility, to throw a colon and a space in there. That pseudo URI is really unobtrusive.

[abbr](: "expansion")

My preferred unified abbreviation and term definition syntax, however, includes straight apostrophe or quotation marks and round parentheses:

'expansion' (abbr)

'definition' (optional text: "term")

(Details, like number and type of apostrophes, are of course open to improvement. The space before opening parenthesis may need to be suppressed.)