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 should support arbitrary id attributes, not just <a> tags #538

Closed
MarkLodato opened this issue Jul 26, 2022 · 1 comment · Fixed by #539
Closed

MD051 should support arbitrary id attributes, not just <a> tags #538

MarkLodato opened this issue Jul 26, 2022 · 1 comment · Fixed by #539

Comments

@MarkLodato
Copy link
Contributor

MD051 currently only checks <a> tags for id="..." attributes, but this requirement seems arbitrary. Any HTML element may have an id attribute to define an anchor.

It seems like this can be easily fixed by removing the check for a tags on line 58.

In my case, I have a table and use id attributes to link to specfic rows of the table:

# Example

<table>
<tr id="foo"><td>Foo<td>Foo is good
<tr id="bar"><td>Bar<td>Bar is also good
</table>

I like [foo](#foo) and [bar](#bar).
$ npx markdownlint test.md
test.md:8:8 MD051/link-fragments Link fragments should be valid [Context: "[foo](#foo) and [bar](#bar)"]
test.md:8:8 MD051/link-fragments Link fragments should be valid [Context: "[foo](#foo)"]

Would you be willing to accept a PR that fixes this, or is there some other reason why only a tags are accepted?

@DavidAnson
Copy link
Owner

Yes, I would accept a PR for this! Please read the CONTRIBUTING guide first. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants