markdownlint: MD046 - Triggers violation incorrectly

I’ve been using markdownlint-cli in my docs repositories. I upgraded from version 0.15.0 to 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.


* Edit `path/to/file.xml` and add the following line beneath `<!-- Add new files`:

\```xml
<file>META-INF/filename.xml</file>
\```

* Create a new interface in `src/main/java` called `com.example.tc.TermsAndConditionService`.

* Add the following method definitions to the interface: _(**Hint:** don't forget to define each method with javadoc comments)_

\```java
a snippet of java code here
\```

MD046 rule is complaining about the following line:

* Create a new interface in `src/main/java` called `com.example.tc.TermsAndConditionService`.

The error message is:

$ markdownlint ../docs/ ./versioned_docs/
../docs/path/to/doc.md:43 MD046/code-block-style Code block style [Expected: fenced; Actual: indented]

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.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Maybe 1 week for the library and 2 more for the CLI?

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

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, 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 markdownlint implementation:

https://dlaa.me/markdownlint/#%25m%23 Issue 252 1. The **Google IdP Information** modal provides values and a certificate to pass back to the WP SAML Auth plugin. The key details are in the Option 1 section%3A ![Google IdP Information](..%2F..%2F..%2Fimages%2Fguides%2Fwordpress-google-sso%2Fgoogle-idp-information.png) - **SSO URL**%3A URL for WordPress to redirect to when initiating the SSO process. - **Entity ID**%3A How WordPress knows to recognize Google Apps. - **Certificate** - How Google Apps knows to trust a request coming from WordPress. 1. Copy the **SSO URL** and **Entity ID** values and paste them into the corresponding fields under **Identity Provider Settings** on the plugin settings page%3A ![Values from the Google SAML App copied to the WP SAML Auth settings](..%2F..%2F..%2Fimages%2Fguides%2Fwordpress-google-sso%2Fplugin-idp-values.png) 1. Download and commit the certificate file to your [`private` directory](%2Fprivate-paths%23private-path-for-code) so it’s inaccessible from the web. You can add upload this file over [sftp](%2Fsftp)%2C or commit it to a local clone of the git repository%2C then commit and push. If the latter%2C you will need to first switch the connection mode to git%3A ```bash{outputLines%3A 2-6%2C 8} sftp -o Port%3D2222 google-saml.1f2a347b....0%40appserver.google-saml.1f2a347b....drush.in sftp> cd code%2Fprivate%2F sftp> put GoogleIDPCertificate-mydomain.com.pem Uploading GoogleIDPCertificate-mydomain.com.pem to %2Fsrv%2Fbindings%2F972dd...%2Fcode%2Fprivate%2F GoogleIDPCertificate-mydomain.com.pem GoogleIDPCertificate-alexfornuto.com. pem 100%25 1253 27.6KB%2Fs 00%3A00 sftp> quit terminus env%3Acommit --message “Added the Google IDP Certificate to a protected path” %24site.%24env [notice] Your code was committed. ```