DavidAnson / markdownlint-cli2

A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library
MIT License
366 stars 48 forks source link

Support mkdocs admonitions #243

Closed theofidry closed 11 months ago

theofidry commented 11 months ago

When you are using mkdocs with a plugin such as mkdocs-material's abmonitions, you will have parts of your documentation like so:

!!! note "Phasellus posuere in sem ut cursus"

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
    nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
    massa, nec semper lorem quam in massa.

So far so good markdownlint-cli2 handles it just fine. However if this text contains a link:

!!! note "Phasellus posuere in sem ut cursus"

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in [massa][messa-link].

Then you will end up with:

MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "messa-link"] [Context: "messa-link: ..."]



I appreciate it may be a bit tricky and undesired to handle this very specific case. However maybe this could be achieved by not considering indented code as a block code, which is often note the case as using the fenced code blocks with a language specified is (often, and by default at least) preferred.
DavidAnson commented 11 months ago

As you note, this is correct behavior for a blockquote.

There is some discussion of your scenario here: https://github.com/DavidAnson/markdownlint/issues/207

That's a little dated, but still relevant.

Admonitions are somewhat controversial: https://talk.commonmark.org/t/feature-request-admonitions-in-commonmark/3619

And do not yet seem to have official support by micromark: https://github.com/micromark/micromark#list-of-extensions

theofidry commented 11 months ago

I see, let's close this as duplicate then :)