github / cmark-gfm

GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support custom heading IDs for cross-section linking

gschulze opened this issue · comments

When linking to a heading within a markdown file, one has to rely on auto-generated heading IDs, which are a lowercase, hyphenated version of the heading text. IDs for headings with the same name are constructed by appending a number that is incremented according to the occurrence of the heading within the document. This is especially problematic if one wants to link to sections from outside of GitHub, as these identifiers are unstable in a sense that rewording of the heading text or changing the order of sections leads to different identifiers.

The markdown extended syntax mentions a possibility to specify custom heading IDs, which unfortunately is currently not supported by GFM: https://www.markdownguide.org/extended-syntax/#heading-ids

I think this feature would be a really nice addition as it greatly improves link stability and consistency.