This seems a waste of good syntx. What if an empty reference definition were given a special meaning as an anchor, as illustrated by the following (which would have been really handy in writing the spec document):
The link text cannot contain links, though it may
contain images. Etc.
... later ...
See the discussion of [link text], above.
where this gets converted to:
<p>The link text cannot contain links, though it may
contain images. Etc.</p>
... later ...
<p>See the discussion of <a href="#link-text">link text</a>, above.</p>
I thought maybe we could insert an anchor element in the AST, and render it in HTML by adding the id to the following block element. But I suppose this wouldn’t work when you have multiple anchor definitions, as would be useful in a paragraph that defines several terms:
We distinguish here between the link
text and the link label....
I take @Knagis’s point about the potential for giving unexpected results in that list case. But I don’t know if such cases are common enough to make this syntax worth avoiding. Note that you’d still be able to do:
That’s funny, because the a is for “anchor”, although it originally was used with the name attribute exclusively.
I think this proposal would do little to no harm for vanilla Markdown, but it may be less backwards compatible with some definition list extensions. I would actually prefer a way to (implicitly) mark definitions <dfn> etc. that would become link targets automatically (besides headings and captions).
Another, related question, do empty-text links have any special semantics or should they acquire some meaning?
It’s tough to think of any use for a link with no text; on the other hand, people do sometimes use images with no alt attribute (though they shouldn’t), and we should keep the connection between image and link syntaxes.
But it is tempting to give some real purpose to these otherwise useless elements, making them a syntax for anchors, perhaps.
Really? Can you elaborate? To me, this sounds like people that know of the legacy <a name="my-anchor"></a> syntax and don’t know they could just jump to any element with an id. Why would you introduce extra a-elements if you could just add an id to a semantically meaningful existing element in your HTML?