does fireball markdown support anchor links?
Alan Hogan
contact at alanhogan.com
Wed Jul 8 22:37:15 EDT 2015
This topic actually just came up at work a few days ago. I had manually
inserted named links, aka anchors, into a README.md file.
In the code review on my check-in, someone suggested I use "the same
format we are already using for the rest of the headings" for
"consistency."
Puzzled at first, I realized GitHub was automatically generating IDs
(and floating link icons, on render) to enable section links.
(No, this is not part of GFM, Github Flavored Markdown. It seems to be a
subsequent step.)
I went ahead and deleted my ugly manual anchors, because Github *does*
already provide this, and it made the source cleaner.
The downside of this is that now the links I made to various sections
will not work if viewed outside of Github (e.g., if someone edits it
with a preview on the local computer).
As I wrote at work --
Generating section links is **not** part of Markdown such as it’s
defined [by Gruber], and various markdown implementations either do it
differently, or not at all.
<h3 id="mysectionname">My Section Name</h3> <!-- showdown --> <h3 id="my-section-
name">My Section Name</h3> <!-- pandoc, kramdown --> <h3
id="my_section_name">My Section Name</h3> <!-- maruku -->
<h3>My Section Name</h3> <!-- most markdown convertors -->
As bowerbird mentioned, there is no consistency (hey, there’s that word
again) in these auto-generated IDs.
Notably, most implementations do not do it at all (as would be expected,
given that original Markdown does not, either).
See the above example for yourself on Babelmark 2:
http://ajh.us/babelmark2-section-ids
Cheers,
Alan Hogan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist6.pair.net/pipermail/markdown-discuss/attachments/20150708/ebb98b7a/attachment.html>
More information about the Markdown-Discuss
mailing list