mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #286] False positives from MD037 for bullet lists using asterisks #246
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#246
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 @alexearnshaw on GitHub (May 5, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/286
Hi,
Since the weekend we have started getting false positives for rule MD037 when using the markdown-cli npm package in the CLI flow for our project.
For an example please see the results of running markdownlint-cli triggered as part of this PR on our project https://github.com/Axway/axway-open-docs/pull/696/checks?check_run_id=645259268
None of the files producing errors have been changed in this PR, so it seems like this check is suddenly failing as the linter is now not identifying the asterisks that are starting bullet list items correctly, and instead detecting them as emphasis markers?
Has there been a change recently that might have caused this?
Seems like it might be related to #280
@alexearnshaw commented on GitHub (May 5, 2020):
Just to add a little more info - these false positives also suddenly appear using the VScode extension:
@XhmikosR commented on GitHub (May 5, 2020):
Came here to report a similar issue @DavidAnson.
This triggers MD037 while it shouldn't:
Seems a regression somewhere after markdownlint v0.19.0 since we are using markdownlint-cli 0.22.0 (markdownlint v0.19.0) and after updating to v0.20.0 we get the above.
@andreamussap commented on GitHub (May 5, 2020):
Hi. One more example - https://github.com/Axway/axway-open-docs/pull/672/checks?check_run_id=646024890
@DavidAnson commented on GitHub (May 5, 2020):
Could folks please share specific examples? It’s not always possible to tell what’s going on from screenshots and test results.
@XhmikosR, I see your scenario, thanks. Here’s a minimal repro: https://dlaa.me/markdownlint/#%25m%23%20Issue%20286%0A%0A%5BLink%5D(under_score)%20followed%20by%20_underscore_%0A
@DavidAnson commented on GitHub (May 5, 2020):
@alexearnshaw, your scenario seems fine in isolation, what am I missing? Link to the file?
https://dlaa.me/markdownlint/#%25m%23%20Issue%20286%0A%0A%3Alabel%0A%20%20*%20List%20item%0A%20%20*%20List%20item%0A%0A%3C!--%20markdownlint-disable-file%20ul-indent%20blanks-around-lists%20--%3E%0A
@XhmikosR commented on GitHub (May 5, 2020):
@DavidAnson the repo is here https://github.com/pi-hole/docs
@DavidAnson commented on GitHub (May 5, 2020):
@andreamussap, From what I see of your test output, you may be seeing the same list item behavior as above - though I don’t yet have a demo of that problem. Link to a problem file?
@andreamussap commented on GitHub (May 5, 2020):
@DavidAnson Alex and I work on the same project, so the issue is the same. If you go to this link https://github.com/Axway/axway-open-docs/pull/672/checks?check_run_id=646024890 you will see a red X before the Run markdown linter check.
Click to expand it and you'll see the MD037 errors, eg: content/en/docs/apigtw_devguide/jython_scripting.md:26:5 MD037/no-space-in-emphasis Spaces inside emphasis markers [Context: "* Print a list of all referenc**..."]
The issue is that, suddenly, the markdownlinter thinks that the asterisks before the sentence is to make it bold/italic, but this is just to create an unordered list, as you can see here, on the page - https://axway-open-docs.netlify.app/docs/apigtw_devguide/jython_scripting/
These pages are there for ages, everything was working until last Friday (May 1st 2020)
@DavidAnson commented on GitHub (May 5, 2020):
@andreamussap @alexearnshaw The content you have is not a valid list according to strict CommonMark parsing. Example below from that file. (What parser are you using and are you using any syntax extensions?) Also, I need to understand the difference between strict and non-strict mode.
https://markdown-it.github.io/#md3=%7B%22source%22%3A%22%60analyze%60%5Cn%3A%20This%20category%20contains%20scripts%20to%3A%5Cn%20%20%20%20%2A%20Print%20a%20list%20of%20all%20references%20in%20the%20API%20Gateway.%20For%20each%20reference%20it%20shows%20what%20store%20it%20originates%20from%20and%20to.%5Cn%20%20%20%20%2A%20Check%20if%20the%20API%20Gateway%20is%20locked%20down.%5Cn%20%20%20%20%2A%20Get%20a%20list%20of%20unresolved%20references%20between%20entities%20in%20the%20API%20Gateway.%5Cn%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%3Atrue%2C%22_view%22%3A%22html%22%7D%7D
@andreamussap commented on GitHub (May 5, 2020):
@DavidAnson since you asked for a demo I've recorded this video - not even sure if you still need it
https://www.loom.com/share/ca68c88dce1e40359a8e1ca1ac092f18
on the strict and non-strict mode I don't know this answer. Will have to wait for @alexearnshaw
@alexearnshaw commented on GitHub (May 5, 2020):
@DavidAnson we are using Hugo with Blackfriday parser. Our project is https://github.com/Axway/axway-open-docs
Looking into this a bit more, it does seem that most of these new errors that appeared today for MD037 are to do with asterisks being used for list items within a definition list, so perhaps our Markdown is wrong...and maybe this isn't a markdownlint issue after all. I'm not sure if unordered list items within a definition list are valid, so maybe we just need to change our files...
However I'm still wondering why we didn't get these errors with the same files/same content last week - has anything changed in markdownlint (that would affect both markdownlint-cli and vscode extension) that would make these rule violations suddenly appear now, when they didn't before?
@DavidAnson commented on GitHub (May 5, 2020):
@alexearnshaw This is almost certainly due to a change I made to re-implement that rule in the recent release. Per comments in a separate issue, it looks like this project directly installs the CLI as part of its CI Action which helps explain the timeline: https://github.com/Axway/axway-open-docs/pull/696#issuecomment-624269827
The problematic syntax here appears valid for your toolset, so I’m not prepared to say that it is “wrong“. :) That said, the link I provided demonstrates that it is not valid CommonMark in strict mode. I need to do some research to understand why it is valid in non-strict mode. I don’t know yet whether I can switch the linter to non-strict mode.
One thing you may be able to do is add a blank line between the list and the previous label. I’m not sure if that has the same meaning in Hugo/Blackfriday, but would almost definitely address the issue with the linter.
@DavidAnson commented on GitHub (May 6, 2020):
@alexearnshaw, an update:
The problematic structure is called a definition list. Here's the syntax and corresponding HTML: https://www.markdownguide.org/extended-syntax/#definition-lists
This is not natively part of the CommonMark spec which is why it is not recognized (i.e., "strict mode") by the underlying parser or
markdownlint.There is a plug-in to add support for this to the parser and plugins are supported by
markdownlint, but sadly not by the CLI: https://github.com/markdown-it/markdown-it-deflistThat said, I don't think the use of definition lists by this project is correct; the relevant items are not terms or descriptions: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl
Rather, they appear to me to be lists, so I would suggest converting the project to use standard Markdown lists which should not trigger the problematic warnings.
Note that definition lists aren't rendered properly by GitHub, either, which is why the "analyze", etc. sections here look like paragraphs instead of lists: https://github.com/Axway/axway-open-docs/blob/master/content/en/docs/apigtw_devguide/jython_scripting.md
As such, I do not currently think this is a bug in
markdownlint. Please let me know what you think.@alexearnshaw commented on GitHub (May 6, 2020):
@DavidAnson I agree this is not a bug in markdownlint. Thanks a lot for your help and advice!
@DavidAnson commented on GitHub (May 7, 2020):
Great, thanks for working through this! I'm going to close this issue as we no longer think bullet lists are a problem. I'm tracking the other MD037 issues separately and will fix them soon.
@DavidAnson commented on GitHub (May 8, 2020):
@XhmikosR, your scenario is fixed in the next release by
github.com/DavidAnson/markdownlint@37f1d6b64b. The Pi-Hole repository is protected from surprise regressions by https://github.com/DavidAnson/markdownlint/actions?query=workflow%3ATestRepos.@XhmikosR commented on GitHub (May 9, 2020):
@DavidAnson Thanks! Just keep in mind that it's using some non-standard syntax in a few places.