MD046 - Triggers violation incorrectly
See original GitHub issueI’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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (10 by maintainers)
Top GitHub 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