mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 01:05:55 +03:00
[GH-ISSUE #249] Investigate generalized support for skipping block/inline content via regular expression (or similar) #213
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#213
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @XhmikosR on GitHub (Jan 24, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/249
Hey, @DavidAnson!
I have a WIP branch in https://github.com/twbs/bootstrap/compare/master-xmr-markdownlint where I'm trying to add markdownlint through markdownlint-cli.
It seems I'm hitting a few issues and I'm not sure how to proceed. I mean, most are due to our mix of Hugo shortcodes, but I'm reaching out in case you have any suggestions or if any improvements can be made.
CI link so make things a little easier
This seems a false positive since the block is inside a Hugo shortcode (
{{< example >}}). If I change this toconsistentit no longer complains. Or if I just remove the newline.This is also a false positive because the URLs also have a hugo function (
- Follow [@getbootstrap on Twitter](https://twitter.com/{{< param twitter >}}).). I'm not sure if you can do anything about this{{< markdown >}}blocks.@DavidAnson commented on GitHub (Jan 24, 2020):
I’ll try to respond to these as I have time. I’m on my phone at the moment, but I think I can help with the first question.
The markdown-it parser does not recognize Hugo syntax; the line it reports appears to be the first that is indented by four spaces which represents a code block. You can see this by pasting the content here: https://markdown-it.github.io/
What I think you want is for these Hugo blocks to be treated as code and in order to do that you might have the best luck with a custom markdown-it plugin. The last four test cases in this project show how to reference plug-ins. A quick search of npm did not turn up an existing one, but maybe you can find one or thinking about adding one.
@DavidAnson commented on GitHub (Jan 24, 2020):
For the second issue, the content as it exists does contain a bare link according to CommonMark rules: https://markdown-it.github.io/#md3=%7B%22source%22%3A%22Follow%20%5B%40getbootstrap%20on%20Twitter%5D%28https%3A%2F%2Ftwitter.com%2F%7B%7B%3C%20param%20twitter%20%3E%7D%7D%29.%22%2C%22defaults%22%3A%7B%22html%22%3Afalse%2C%22xhtmlOut%22%3Afalse%2C%22breaks%22%3Afalse%2C%22langPrefix%22%3A%22language-%22%2C%22linkify%22%3Atrue%2C%22typographer%22%3Atrue%2C%22_highlight%22%3Atrue%2C%22_strict%22%3Afalse%2C%22_view%22%3A%22html%22%7D%7D
In this case, I’m not sure a custom plug-in would help because the scenario is not recognizing the new syntax, but modifying an existing one.
Would it be possible for you to lint these files after the Hugo tags had been applied?
@DavidAnson commented on GitHub (Jan 24, 2020):
I think the answer to the third question is a custom plug-in for Hugo.
For questions number one and number three, I think a custom plug-in that understands Hugo syntax will do what you want. For question number two, I’m not sure.
@XhmikosR commented on GitHub (Feb 7, 2020):
So I guess it boils down to I'd there's a way to skip some snippets. Does
this sound like a good addition?
On Fri, Jan 24, 2020, 19:00 David Anson notifications@github.com wrote:
@DavidAnson commented on GitHub (Feb 8, 2020):
Are you suggesting generalized support for skipping certain kinds of block or inline content via regular expression or something? That could have some uses and would probably be sufficient for your purposes here. I’d worry about coming up with something that’s powerful enough without being too complicated, but I’d be happy to look into this for the next release.
@XhmikosR commented on GitHub (Feb 11, 2020):
Yup, I guess this would solve any issues for our use case and similar ones. Not sure how hard it'll be to implement :)
@DavidAnson commented on GitHub (Aug 5, 2023):
@XhmikosR, is this still relevant?
@XhmikosR commented on GitHub (Dec 17, 2023):
@DavidAnson sorry for the late reply. Yes, this would help us a lot since we still need to exclude Hugo-specific blocks. It's been a while since I last ran Markdownlint against our repo, though.