Make anchor ids consistent with GFM and other markdown parsers
Currently when we create anchors ids for headers, such as # This - and that
, we use an algorithm that matches what our old markdown parser, Redcarpet, did. This means in particular any duplicate -
are stripped out.
So for example, with # This - and that
we get #this-and-that
.
However for most other parsers, including Goldmark (used by Hugo), Kramdown (used by our docs site), GFM, link testers, LSP-marksman, etc, they don't strip out the dashes. So it becomes #this---and-that
.
It would be beneficial to change this so that we're consistent not only with the other uses of markdown parsers, but also with link linters, and most everyone else.
See the discussion Discussion: Strip extra dash characters from he... (technical-writing#990 - closed)
gitlab-glfm-markdown/comrak
does in fact support generating the anchor ids in the correct fashion. So I recommend starting to use that, and removing the older code.
Caveat
This will have the effect of rendering a subset of anchor ids invalid. For example, a check in our documentation in another discussion showed a possible 77 instances where the anchor in the document would be directly effected.
There is also the possibility of some links to anchors in wiki pages becoming invalid.
Note that the links themselves will not be broken, just scrolling to the proper header within a page, which is much less of a problem.