Hello,
I’d like to ask if there is a syntax more popular than others for anchoring headings that people would recommend ?
GitHub generates the anchors itself based on the heading inline content but that’s no so great for your links’ stability.
Also in light of this proposal for anchors. I thought that a simple scheme for identifying blocks is to use undefined shortcut reference links:
The first shortcut reference link that occurs in a block whose label starts with a
#
and that is undefined in the document is removed from the text flow and defines the identifier for the block.
So you would have:
# My heading [#heading-id] | <h1 id="heading-id">My heading </h1>
# My [#heading-id] heading | <h1 id="heading-id">My heading</h1>
# [#heading-id] My heading | <h1 id="heading-id"> My heading</h1>
|
This is an [#pid] important | <p id="pid">This is an important
paragraph it deserves an | paragraph it deserves an
[#notanid] an id. | [#notanid] an id.</p>
But I wonder what all the people here much more versed in that than me would think of that.
In fact this came to me while thinking about (ab)using markdown as a templating system. By using the luckily very unconstrained label of undefined shortcut reference links as a DSL to bind data (e.g. [article.name]
, [article.date|yyyy-mm-dd]
) and/or invoke other template fragment.
For that usage the spec doesn’t have to say anything about this, it’s a matter of allowing your parser API to do fancy stuff on unknown link resolution. But I wonder is anyone aware of such a markdown template based system ? No CMS or website generation system I had to surrender to ever had markdown as the templating system itself. But I’m a bit toying with that idea now.