Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MD051: Add support for Gitiles section anchors and named anchors #570

Open
dholm opened this issue Aug 30, 2022 · 6 comments
Open

MD051: Add support for Gitiles section anchors and named anchors #570

dholm opened this issue Aug 30, 2022 · 6 comments

Comments

@dholm
Copy link

dholm commented Aug 30, 2022

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)
@DavidAnson DavidAnson changed the title MD051 support for Gitiles section headings Add support to MD051 for Gitiles section anchors and named anchors Aug 30, 2022
dfarrell07 added a commit to dfarrell07/submariner-website that referenced this issue Oct 6, 2022
This syntax for creating ID tags for headings (typcially with complex
names) isn't supported in CommonMark, which is the standard used by our
MD linter. It's valid syntax in Gitiles MD, which is why the links work.

Upstream feature request to add support for this type of header ID:
DavidAnson/markdownlint#570

This is required for submariner-io#827.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
dfarrell07 added a commit to dfarrell07/submariner-website that referenced this issue Oct 6, 2022
This syntax for creating ID tags for headings (typcially with complex
names) isn't supported in CommonMark, which is the standard used by our
MD linter. It's valid syntax in Gitiles MD, which is why the links work.

Upstream feature request to add support for this type of header ID:
DavidAnson/markdownlint#570

This is required for submariner-io#827.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
dfarrell07 added a commit to dfarrell07/submariner-website that referenced this issue Oct 6, 2022
This syntax for creating ID tags for headings (typically with complex
names) isn't supported in CommonMark, which is the standard used by our
MD linter. It's valid syntax in Gitiles MD, which is why the links work.

Upstream feature request to add support for this type of header ID:
DavidAnson/markdownlint#570

This is required for submariner-io#827.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
sridhargaddam pushed a commit to dfarrell07/submariner-website that referenced this issue Oct 9, 2022
This syntax for creating ID tags for headings (typically with complex
names) isn't supported in CommonMark, which is the standard used by our
MD linter. It's valid syntax in Gitiles MD, which is why the links work.

Upstream feature request to add support for this type of header ID:
DavidAnson/markdownlint#570

This is required for submariner-io#827.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
tpantelis pushed a commit to submariner-io/submariner-website that referenced this issue Oct 9, 2022
This syntax for creating ID tags for headings (typically with complex
names) isn't supported in CommonMark, which is the standard used by our
MD linter. It's valid syntax in Gitiles MD, which is why the links work.

Upstream feature request to add support for this type of header ID:
DavidAnson/markdownlint#570

This is required for #827.

Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
@DavidAnson
Copy link
Owner

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.

@fekete-robert
Copy link

+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.

@scottamain
Copy link

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?

@DavidAnson
Copy link
Owner

@scottamain Please do. I think supporting named anchors is more straightforward and has value in isolation.

@scottamain
Copy link

Done: #830

@Svintooo
Copy link

Svintooo commented Jun 9, 2023

+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.

@DavidAnson DavidAnson changed the title Add support to MD051 for Gitiles section anchors and named anchors MD051: Add support for Gitiles section anchors and named anchors Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants