[GH-ISSUE #585] MD038: allow code in nested blocks #463

Closed
opened 2026-03-03 01:27:09 +03:00 by kerem · 2 comments
Owner

Originally created by @gforcada on GitHub (Sep 22, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/585

We are happily using mkdocs with the popular mkdocs-material plugin. One of its plugins is admonitions, which let's you have fancy boxes with some text within it.

Unfortunately markdownlint and admonitions do not play well together if one wants to have a fancy box with some code block on it, i.e.:

To prevent you from making synatx mistakes, use `markdownlint` ✨ 

!!! example
    ```shell
    markdownlint-cli2 "docs/**/*.md"
    ```

But markdownlint will report a MD038 as there are spaces on the code.

Same happens on plain lists:

- one entry
- another one
  - see this code:
    ```shell
    markdownlint-cli2 "docs/**/*.md"
    ```

Would it be possible to either have another code that can be ignored, or check that the line that would issue a MD038 is actually within a scope/block, and if its indentation matches that of the block then it does not mark it as a problem?

i.e. this should get a warning as markdownlint-cli2 "docs/**/*.md" is indented way too much, but the examples above should be fine

- one entry
- another one
  - see this code:
    ```shell
            markdownlint-cli2 "docs/**/*.md"
    ```

Thanks for the time to build this tool!! 😄

Originally created by @gforcada on GitHub (Sep 22, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/585 We are happily using `mkdocs` with the popular `mkdocs-material` plugin. One of its plugins is [admonitions](https://squidfunk.github.io/mkdocs-material/reference/), which let's you have fancy boxes with some text within it. Unfortunately `markdownlint` and admonitions do not play well together if one wants to have a fancy box with some code block on it, i.e.: ```markdown To prevent you from making synatx mistakes, use `markdownlint` ✨ !!! example ```shell markdownlint-cli2 "docs/**/*.md" ``` ``` But `markdownlint` will report a `MD038` as there are spaces on the code. Same happens on plain lists: ```markdown - one entry - another one - see this code: ```shell markdownlint-cli2 "docs/**/*.md" ``` ``` Would it be possible to either have another code that can be ignored, or check that the line that would issue a `MD038` is actually within a scope/block, and if its indentation matches that of the block then it does not mark it as a problem? i.e. this should get a warning as `markdownlint-cli2 "docs/**/*.md"` is indented way too much, but the examples above should be fine ```markdown - one entry - another one - see this code: ```shell markdownlint-cli2 "docs/**/*.md" ``` ``` Thanks for the time to build this tool!! ✨ 😄
kerem 2026-03-03 01:27:09 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner
<!-- gh-comment-id:1255005683 --> @nschonni commented on GitHub (Sep 22, 2022): https://github.com/DavidAnson/markdownlint/search?q=admonitions&type=issues
Author
Owner
<!-- gh-comment-id:1255154975 --> @DavidAnson commented on GitHub (Sep 22, 2022): Here is your plain list example; it does not produce MD038 for me. What am I missing? https://dlaa.me/markdownlint/#%25m%23%20Issue%20585%0A%0A-%20one%20entry%0A-%20another%20one%0A%20%20-%20see%20this%20code%3A%0A%20%20%20%20%60%60%60shell%0A%20%20%20%20markdownlint-cli2%20%22docs%2F**%2F*.md%22%0A%20%20%20%20%60%60%60%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#463
No description provided.