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

MD052 triggered by selected checkbox in github flavoured markdown #1524

Open
deosrc opened this issue Mar 2, 2025 · 6 comments
Open

MD052 triggered by selected checkbox in github flavoured markdown #1524

deosrc opened this issue Mar 2, 2025 · 6 comments

Comments

@deosrc
Copy link

deosrc commented Mar 2, 2025

As per the title, MD052 is being triggered by selected checkboxes in github flavoured markdown:

- [x] Checked item
MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "x"] [Context: "[x]"]
@deosrc
Copy link
Author

deosrc commented Mar 2, 2025

Realised this was caused by this configuration I coped from https://github.com/DavidAnson/markdownlint/blob/main/.markdownlint.json

  "reference-links-images": {
    "shortcut_syntax": true
  },

@DavidAnson
Copy link
Owner

Is there anything to indicate this is supposed to be a checkbox instead of being a missing reference definition as is being reported? Should every instance of [x] be ignored in case it could be a checkbox? For my own future reference, maybe this is only meaningful as the first thing of a list item? https://github.blog/news-insights/product-news/task-lists-in-gfm-issues-pulls-comments/

@DavidAnson
Copy link
Owner

I think this is a scenario where you should disable the rule (at least for now) - you can use inline comments to do so for just the TODO list.

@DavidAnson
Copy link
Owner

Realised this was caused by this configuration I coped from ...

Good point! I configure it to be extra picky, so this shouldn't be seen by default. Thanks for calling that out.

@deosrc
Copy link
Author

deosrc commented Mar 2, 2025

Thanks, yes I've disabled the rule.

A quick test suggests checkboxes only work in lists:

[ ] Not a checkbox
[x] Not a checkbox

- [ ] Checkbox
- [x] Selected checkbox 

[ ] Not a checkbox
[x] Not a checkbox

  • Checkbox
  • Selected checkbox

A reference link of [x] would seem unlikely, until a major social media site had a rename.

@DavidAnson
Copy link
Owner

Haha! FYI, I think you can opt out of the customization from my configuration and keep the rule on but skip the strict shortcut behavior I enabled. (I'm not sure if that was clear.) Thanks for doing that bit of research!

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

2 participants