mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #252] MD046 - Triggers violation incorrectly #2062
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#2062
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 @amimas on GitHub (Feb 7, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/252
I've been using markdownlint-cli in my docs repositories. I upgraded from version
0.15.0to latest (0.21.0), which makes the rule MD046 available.This rule seems to be triggering violations incorrectly. Below is a snippet of content. Please ignore the
\at the beginning of code block fences. I added those so that the entire snippet below gets rendered together on github.MD046 rule is complaining about the following line:
The error message is:
Notice that the line it is reporting problem does not have code blocks. It only has inline code wrapped with backticks. I'm getting similar errors being reported on a lot of other lines.
I've checked the existing issues related to MD046 but they didn't seem to mention the type of issues I've explained here. Hopefully this is not a duplicate issue.
@DavidAnson commented on GitHub (Feb 7, 2020):
Is the problem still present if you remove the opening HTML comment (“<!--“) on the first line?
@amimas commented on GitHub (Feb 8, 2020):
I think so because this is being reported on other files as well. I have since reverted back to the older version I was using. I'll have to try to reproduce the issue.
@DavidAnson commented on GitHub (Feb 8, 2020):
If you can link to a file that shows this problem, I can narrow things down to identify the cause. Thanks!
@DavidAnson commented on GitHub (Feb 13, 2020):
The example above does not seem to generate any errors in the current version of the library. Please provide an example that does so I can investigate further.
https://dlaa.me/markdownlint/#%25m%23%20Issue%20252%0A%0A*%20Edit%20%60path%2Fto%2Ffile.xml%60%20and%20add%20the%20following%20line%20beneath%20%60%3C!--%20Add%20new%20files%60%3A%0A%0A%60%60%60xml%0A%3Cfile%3EMETA-INF%2Ffilename.xml%3C%2Ffile%3E%0A%60%60%60%0A%0A*%20Create%20a%20new%20interface%20in%20%60src%2Fmain%2Fjava%60%20called%20%60com.example.tc.TermsAndConditionService%60.%0A%0A*%20Add%20the%20following%20method%20definitions%20to%20the%20interface%3A%20_(Hint%3A%20don't%20forget%20to%20define%20each%20method%20with%20javadoc%20comments)_%0A%0A%60%60%60java%0Aa%20snippet%20of%20java%20code%20here%0A%60%60%60
@amimas commented on GitHub (Feb 13, 2020):
Okay. I'll try to get a working sample. Thanks for looking into this.
@DavidAnson commented on GitHub (Feb 13, 2020):
Thanks! FYI, the latest version of the CLI is now 0.22.0.
@amimas commented on GitHub (Feb 16, 2020):
I just had a chance to debug this a little bit more and I realized that the error actually comes from few lines of texts above what I had originally posted. I also tried with the latest version and seem to be having the same issue.
I used the online tool you posted above, with an extended snippet of my content and was able to reproduce it there; reproducible issue on markdownlint demo
Also, while preparing this snippet, I noticed markdownlint is reporting the following error, which also seems to be false positive.
The above error is complaining about not having blank lines after a list item at the end of the contents. But clearly there is an empty line. If I add an extra empty line (2 blank lines at the end), then the above error is not reported anymore.
@alexfornuto commented on GitHub (Feb 20, 2020):
Thanks for the great plugin! I'm also getting a conflict with MD046 and MD007 in VSCode. A bulleted list under a numbered step needs a 4-space indent, which MD046 is seeing as an indented code block. It's the inverse of @amimas's issue, since in my example the bullets come before the code fences.
I reckon the simple fix is to have MD046 ignore tabbed lines that start with a single bullet character followed by a space.
@DavidAnson commented on GitHub (Feb 20, 2020):
Could you please provide an example of your scenario? I’ll make sure both scenarios are covered by the fix.
@alexfornuto commented on GitHub (Feb 20, 2020):
Sure! As above, I'm adding
\to my code fences for GitHub comment formatting:@DavidAnson commented on GitHub (Mar 10, 2020):
@alexfornuto, there only need to be three spaces for the sub-list. After making that change and tweaking some of the other spacing, your example does not report any errors with the currently-published
markdownlintimplementation:https://dlaa.me/markdownlint/#%25m%23%20Issue%20252%0A%0A1.%20The%20Google%20IdP%20Information%20modal%20provides%20values%20and%20a%20certificate%20to%20pass%20back%20to%20the%20WP%20SAML%20Auth%20plugin.%20The%20key%20details%20are%20in%20the%20Option%201%20section%3A%0A%0A%20%20%20!%5BGoogle%20IdP%20Information%5D(..%2F..%2F..%2Fimages%2Fguides%2Fwordpress-google-sso%2Fgoogle-idp-information.png)%0A%0A%20%20%20-%20SSO%20URL%3A%20URL%20for%20WordPress%20to%20redirect%20to%20when%20initiating%20the%20SSO%20process.%0A%0A%20%20%20-%20Entity%20ID%3A%20How%20WordPress%20knows%20to%20recognize%20Google%20Apps.%0A%0A%20%20%20-%20Certificate%20-%20How%20Google%20Apps%20knows%20to%20trust%20a%20request%20coming%20from%20WordPress.%0A%0A1.%20Copy%20the%20SSO%20URL%20and%20Entity%20ID%20values%20and%20paste%20them%20into%20the%20corresponding%20fields%20under%20Identity%20Provider%20Settings%20on%20the%20plugin%20settings%20page%3A%0A%0A%20%20%20!%5BValues%20from%20the%20Google%20SAML%20App%20copied%20to%20the%20WP%20SAML%20Auth%20settings%5D(..%2F..%2F..%2Fimages%2Fguides%2Fwordpress-google-sso%2Fplugin-idp-values.png)%0A%0A1.%20Download%20and%20commit%20the%20certificate%20file%20to%20your%20%5B%60private%60%20directory%5D(%2Fprivate-paths%23private-path-for-code)%20so%20it's%20inaccessible%20from%20the%20web.%20You%20can%20add%20upload%20this%20file%20over%20%5Bsftp%5D(%2Fsftp)%2C%20or%20commit%20it%20to%20a%20local%20clone%20of%20the%20git%20repository%2C%20then%20commit%20and%20push.%20If%20the%20latter%2C%20you%20will%20need%20to%20first%20switch%20the%20connection%20mode%20to%20git%3A%0A%0A%20%20%20%60%60%60bash%7BoutputLines%3A%202-6%2C%208%7D%0A%20%20%20sftp%20-o%20Port%3D2222%20google-saml.1f2a347b....0%40appserver.google-saml.1f2a347b....drush.in%0A%20%20%20sftp%3E%20cd%20code%2Fprivate%2F%0A%20%20%20sftp%3E%20put%20GoogleIDPCertificate-mydomain.com.pem%0A%20%20%20Uploading%20GoogleIDPCertificate-mydomain.com.pem%20to%20%2Fsrv%2Fbindings%2F972dd...%2Fcode%2Fprivate%2F%20GoogleIDPCertificate-mydomain.com.pem%0A%20%20%20GoogleIDPCertificate-alexfornuto.com.%20pem%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20100%25%201253%20%20%20%2027.6KB%2Fs%20%20%2000%3A00%0A%20%20%20sftp%3E%20quit%0A%20%20%20terminus%20env%3Acommit%20--message%20%22Added%20the%20Google%20IDP%20Certificate%20to%20a%20protected%20path%22%20%24site.%24env%0A%20%20%20%20%5Bnotice%5D%20Your%20code%20was%20committed.%0A%20%20%20%60%60%60%0A
@amimas commented on GitHub (Mar 10, 2020):
@DavidAnson - Thanks for looking into this. Noticed you added the label
fixed in next. I think I have a lot of contents that has sub-list items and they are indented with 4 spaces. Is that also going to work in that next version?@DavidAnson commented on GitHub (Mar 10, 2020):
Yes, the fix was to ignore un-closed HTML comments. All formatting will be handled the same.
@alexfornuto commented on GitHub (Mar 10, 2020):
@DavidAnson
The problem with using 3 spaces to indent the sub-list is that it triggers MD007Ahh, I had to look at what you meant by "tweaking some of the other spacing".I'm curious, is the spec on how many spaces should be used for indenting defined anywhere?
@DavidAnson commented on GitHub (Mar 10, 2020):
Please open my example link above. That is your scenario. I used 3 spaces for that list without warnings. I think I also had to invent the image above it by 3 spaces.
@alexfornuto commented on GitHub (Mar 10, 2020):
Sorry, tried to update my comment before you saw it.
@DavidAnson commented on GitHub (Mar 10, 2020):
Cool. The general guideline I use is that content of a list item should be indented to match the list marker. That is usually 2 spaces for unordered lists and 3 spaces for ordered lists.
The spec has a lot more detail: https://spec.commonmark.org/0.29/#list-items
@amimas commented on GitHub (Apr 6, 2020):
@DavidAnson - Thanks again for looking into this quickly. Any idea when this will be released? In my projects, I don't really consume this directly. It's a transitive dependency through markdownlint-cli.
@DavidAnson commented on GitHub (Apr 6, 2020):
Maybe 1 week for the library and 2 more for the CLI?