Should implementations use the ID from reference links, images and the like (
[A][ID]) to populate the
id attribute in the generated HTML output? They currently don’t. Like with auto generated identifiers for headings (as in Pandoc, Maruku, Showdown and Kramdown), they would have to add a disambiguating counter if a reference is used twice or more.
<p><a href="HREF" id="ID">A</a></p>
These anchors may not be the most important thing for interactive hyperlinks, but imagine printed documents where you could output a References or Bibliography section with backlinks to the actual citations of a certain entry. It might also be useful for future extensions that overload the link syntax.
This is an interesting idea. Adding IDs to reference links and images would make the document less cluttered (compared to say, using attribute syntax enclosed within curly brackets). There is also the advantage of the document being less repetitive.
If IDs are generated there should probably be an option for namespacing to avoid clashes with external IDs. E.g. for a discourse forum post, the ID could be prefixed with “discourse-POSTID-” which would be passed to the parser.
For new developers who will come here across searching for extensibillity I create proposal for more extensible and modular commonmark Flexibility and modularity for the win! and also extensions’ ecosystem
I don’t see how the Github issue thread affects this question specifically, except that one could probably implement anchor IDs with
commonmark-helpers easily some day.