Skip to content

MD052: Add option to apply to shortcut reference links too #915

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

Closed
waldyrious opened this issue Jul 22, 2023 · 5 comments
Closed

MD052: Add option to apply to shortcut reference links too #915

waldyrious opened this issue Jul 22, 2023 · 5 comments

Comments

@waldyrious
Copy link

waldyrious commented Jul 22, 2023

Currently, MD052 has the following caveat:

"Shortcut" syntax is ambiguous and a missing label will not generate an error. For example, [shortcut] could be a shortcut link or the text "shortcut" in brackets.

I'd like to have an option (defaulting to false in light of the caveat above) to make MD052 also apply to shortcut-syntax reference links, so that I could configure it like this:

# MD052/reference-links-images
MD052:
  # Also validate reference links using shortcut syntax
  shortcut_links: true

(This issue stems from a discussion that started here.)

@DavidAnson
Copy link
Owner

This modification would basically assume that every instance of "[whatever]" in a document was intended to be a link rather than text in brackets. I'm not sure that's very common?

@waldyrious
Copy link
Author

Yeah, I do agree it is likely to catch false positives, hence the suggestion to default to false. My use case is for specific documents, like this changelog, where using the collapsed syntax would be cumbersome given the number of links. So the configuration to enable this would likely not be project-wise, but file-wise using frontmatter, or even section-wise using HTML comments.

@DavidAnson DavidAnson changed the title Add option to MD052 to apply to shortcut reference links too MD052: Add option to apply to shortcut reference links too Aug 5, 2023
@nex3
Copy link

nex3 commented Aug 22, 2023

I would very much appreciate this. My Markdown corpus universally uses shortcut-style links, because they're strictly shorter than collapsed-style links, but currently we lose all linting for these links (and in practice we relatively frequently forget to add references). I would love a configuration option for MD052 that would catch these issues. (In the rare cases where I need to use square brackets outside of code formatting, I'd prefer to write \[foo].)

@waldyrious
Copy link
Author

Thank you for implementing this, @DavidAnson! 💯 🙏

@ElCuboNegro
Copy link

MD052/reference-links-images is a false positive in all the wikilinks cases.

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

4 participants