[GH-ISSUE #402] MD044: Code blocks not being ignored when requested #2183

Closed
opened 2026-03-07 20:05:20 +03:00 by kerem · 3 comments
Owner

Originally created by @skyzyx on GitHub (Jun 4, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/402

Package Version
markdownlint-cli 0.27.1
markdownlint ~0.23.1

I run into this issue often where ignoring code blocks is sometimes followed, and sometimes not.


The proper case is: Docker

So this is wrong: docker

But should be okay in inline code blocks: On Amazon Linux 2, overlay2 is configured to use the default /var/lib/docker/overlay2 directory, which is on the root filesystem.

And also should be okay in fenced code blocks:

After=network.target docker.service

And also should be okay in un-fenced code blocks:

After=network.target docker.service

https://dlaa.me/markdownlint/#%25m%23%20Issue%20402%0A%0AThe%20proper%20case%20is%3A%20Docker%0A%0ASo%20this%20is%20wrong%3A%20docker%0A%0ABut%20should%20be%20okay%20in%20inline%20code%20blocks%3A%20On%20Amazon%20Linux%202%2C%20%60overlay2%60%20is%20configured%20to%20use%20the%20default%20%60%2Fvar%2Flib%2Fdocker%2Foverlay2%60%20directory%2C%20which%20is%20on%20the%20root%20filesystem.%0A%0AAnd%20also%20should%20be%20okay%20in%20fenced%20code%20blocks%3A%0A%0A%60%60%60systemd%0AAfter%3Dnetwork.target%20docker.service%0A%60%60%60%0A%0AAnd%20also%20should%20be%20okay%20in%20un-fenced%20code%20blocks%3A%0A%0A%20%20%20%20After%3Dnetwork.target%20docker.service%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%20%20%22proper-names%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22names%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Docker%22%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22code_blocks%22%3A%20false%0A%7D%20--%3E%0A

Originally created by @skyzyx on GitHub (Jun 4, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/402 | Package | Version | |-|-| | markdownlint-cli | `0.27.1` | | markdownlint | `~0.23.1` | I run into this issue _often_ where ignoring code blocks is sometimes followed, and sometimes not. ---- The proper case is: Docker So this is wrong: docker But **should be** okay in inline code blocks: On Amazon Linux 2, `overlay2` is configured to use the default `/var/lib/docker/overlay2` directory, which is on the root filesystem. And also **should be** okay in fenced code blocks: ```systemd After=network.target docker.service ``` And also **should be** okay in un-fenced code blocks: After=network.target docker.service <!-- markdownlint-configure-file { "proper-names": { "names": [ "Docker" ] }, "code_blocks": false } --> ---- https://dlaa.me/markdownlint/#%25m%23%20Issue%20402%0A%0AThe%20proper%20case%20is%3A%20Docker%0A%0ASo%20this%20is%20wrong%3A%20docker%0A%0ABut%20**should%20be**%20okay%20in%20inline%20code%20blocks%3A%20On%20Amazon%20Linux%202%2C%20%60overlay2%60%20is%20configured%20to%20use%20the%20default%20%60%2Fvar%2Flib%2Fdocker%2Foverlay2%60%20directory%2C%20which%20is%20on%20the%20root%20filesystem.%0A%0AAnd%20also%20**should%20be**%20okay%20in%20fenced%20code%20blocks%3A%0A%0A%60%60%60systemd%0AAfter%3Dnetwork.target%20docker.service%0A%60%60%60%0A%0AAnd%20also%20**should%20be**%20okay%20in%20un-fenced%20code%20blocks%3A%0A%0A%20%20%20%20After%3Dnetwork.target%20docker.service%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%20%20%22proper-names%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22names%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Docker%22%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22code_blocks%22%3A%20false%0A%7D%20--%3E%0A
kerem 2026-03-07 20:05:20 +03:00
Author
Owner

@DavidAnson commented on GitHub (Jun 4, 2021):

Your example sets the parameter at the wrong scope (nesting). Fixing that gives the desired behavior: https://dlaa.me/markdownlint/#%25m%23%20Issue%20402%0A%0AThe%20proper%20case%20is%3A%20Docker%0A%0ASo%20this%20is%20wrong%3A%20docker%0A%0ABut%20should%20be%20okay%20in%20inline%20code%20blocks%3A%20On%20Amazon%20Linux%202%2C%20%60overlay2%60%20is%20configured%20to%20use%20the%20default%20%60%2Fvar%2Flib%2Fdocker%2Foverlay2%60%20directory%2C%20which%20is%20on%20the%20root%20filesystem.%0A%0AAnd%20also%20should%20be%20okay%20in%20fenced%20code%20blocks%3A%0A%0A%60%60%60systemd%0AAfter%3Dnetwork.target%20docker.service%0A%60%60%60%0A%0AAnd%20also%20should%20be%20okay%20in%20un-fenced%20code%20blocks%3A%0A%0A%20%20%20%20After%3Dnetwork.target%20docker.service%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%20%20%22proper-names%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22names%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Docker%22%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%22code_blocks%22%3A%20false%0A%20%20%20%20%7D%0A%7D%20--%3E%0A

<!-- gh-comment-id:854266170 --> @DavidAnson commented on GitHub (Jun 4, 2021): Your example sets the parameter at the wrong scope (nesting). Fixing that gives the desired behavior: https://dlaa.me/markdownlint/#%25m%23%20Issue%20402%0A%0AThe%20proper%20case%20is%3A%20Docker%0A%0ASo%20this%20is%20wrong%3A%20docker%0A%0ABut%20**should%20be**%20okay%20in%20inline%20code%20blocks%3A%20On%20Amazon%20Linux%202%2C%20%60overlay2%60%20is%20configured%20to%20use%20the%20default%20%60%2Fvar%2Flib%2Fdocker%2Foverlay2%60%20directory%2C%20which%20is%20on%20the%20root%20filesystem.%0A%0AAnd%20also%20**should%20be**%20okay%20in%20fenced%20code%20blocks%3A%0A%0A%60%60%60systemd%0AAfter%3Dnetwork.target%20docker.service%0A%60%60%60%0A%0AAnd%20also%20**should%20be**%20okay%20in%20un-fenced%20code%20blocks%3A%0A%0A%20%20%20%20After%3Dnetwork.target%20docker.service%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%20%20%22proper-names%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22names%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Docker%22%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%22code_blocks%22%3A%20false%0A%20%20%20%20%7D%0A%7D%20--%3E%0A
Author
Owner

@skyzyx commented on GitHub (Jun 4, 2021):

I had it right in my source code, but wrong in the markdownlint dingus. My bad.

Here is a better example: https://dlaa.me/markdownlint/#%25m%23%20Issue%20402%0A%0A*%20On%20Amazon%20Linux%202%2C%20%60overlay2%60%20is%20configured%20to%20use%20the%20default%20%60%2Fvar%2Flib%2Fdocker%2Foverlay2%60%20directory%2C%20which%20is%20on%20the%20root%20filesystem.%20This%20means%20your%20Docker%20%22storage%20pool%22%20is%20all%20available%20space%20on%20the%20root%20filesystem%3B%20there%20is%20not%20a%20separate%20volume%20for%20Docker.%20Instead%20of%20separate%20root%20and%20docker%20volumes%20of%208G%20and%2022G%2C%20there%20is%20now%20a%20single%2030G%20root%20volume.%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%20%20%22proper-names%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22names%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22aws-vault%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Bash%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Circle%20CI%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Docker%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Dockerfile%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22EditorConfig%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Git%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22GitHub%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Golang%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Hugo%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22JavaScript%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22macOS%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Node%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Node.js%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Non-Prod%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22npm%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22PHP%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Prod%22%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%22code_blocks%22%3A%20false%0A%20%20%20%20%7D%0A%7D%20--%3E%0A

In this case, it appears to correctly detect the word "docker" about 10-ish words from the end of the line.

However, when performing the automated fix, it corrects the wrong instance of the word — the one inside the code blocks.

<!-- gh-comment-id:854847823 --> @skyzyx commented on GitHub (Jun 4, 2021): I had it right in my source code, but wrong in the markdownlint dingus. My bad. Here is a better example: https://dlaa.me/markdownlint/#%25m%23%20Issue%20402%0A%0A*%20On%20Amazon%20Linux%202%2C%20%60overlay2%60%20is%20configured%20to%20use%20the%20default%20%60%2Fvar%2Flib%2Fdocker%2Foverlay2%60%20directory%2C%20which%20is%20on%20the%20root%20filesystem.%20This%20means%20your%20Docker%20%22storage%20pool%22%20is%20all%20available%20space%20on%20the%20root%20filesystem%3B%20there%20is%20not%20a%20separate%20volume%20for%20Docker.%20Instead%20of%20separate%20root%20and%20docker%20volumes%20of%208G%20and%2022G%2C%20there%20is%20now%20a%20single%2030G%20root%20volume.%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%20%20%22proper-names%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22names%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22aws-vault%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Bash%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Circle%20CI%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Docker%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Dockerfile%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22EditorConfig%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Git%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22GitHub%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Golang%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Hugo%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22JavaScript%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22macOS%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Node%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Node.js%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Non-Prod%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22npm%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22PHP%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Prod%22%0A%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%22code_blocks%22%3A%20false%0A%20%20%20%20%7D%0A%7D%20--%3E%0A In this case, it appears to correctly detect the word "docker" about 10-ish words from the end of the line. However, when performing the automated fix, it _corrects_ the wrong instance of the word — the one inside the code blocks.
Author
Owner
<!-- gh-comment-id:856417141 --> @DavidAnson commented on GitHub (Jun 8, 2021): Simplified reproduction: https://dlaa.me/markdownlint/#%25m%23%20Issue%20402%0A%0Atext%20%60docker%60%20text%20docker%20text%0A%0A%3C!--%20markdownlint-configure-file%20%7B%0A%20%20%20%20%22proper-names%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22code_blocks%22%3A%20false%2C%0A%20%20%20%20%20%20%20%20%22names%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Docker%22%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%0A%7D%20--%3E%0A
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2183
No description provided.