MD051: Add support for Gitiles section anchors and named anchors
Would it be possible to add a configuration option for MD051 to support section anchors as defined by Gitiles markdown? I believe they pretty much follow the same convention as GitHub but they keep the case of each character rather than forcing them to lowercase.
It would also be nice if their named anchors could be supported, e.g.:
## Some Section {#name}
...
## Other Section
See [some section](#name)
As I understand the specification you link to, there are a few differences:
- Translation of header text is different, notably for accented characters.
- Nested headings generate unique identifiers based on structure
- Curly bracket syntax can appear anywhere in the file
None of this is unreasonable, but overall it represents more than a trivial tweak to the logic of the existing rule.
+1 for adding support to custom header ids. They are supported in a number of static site generators (for example, Hugo and docusaurus), and in these contexts this markdownlint rule throws a false positive.
I'm very interested in just the second part of this request, so that MD051 will not flag this as an invalid link:
## Some Section {#name}
See [some section](#name)
Currently, I need to disable MD051 (and use a separate linkchecker) because this use-case is important to me.
Should this be filed as a separate enhancement request?
@scottamain Please do. I think supporting named anchors is more straightforward and has value in isolation.
Done: https://github.com/DavidAnson/markdownlint/issues/830
+1 for adding support for gitiles flavored anchors. My company uses gerrit with gitiles for all development, and uses markdownlint in all CI pipelines. And broken links slips through from time to time because MD051 needs to be disabled.