DavidAnson / markdownlint

A Node.js style checker and lint tool for Markdown/CommonMark files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MD045: no-alt-text triggered even though html alt-text is specified

skwde opened this issue · comments

It seems that this should no longer appear, because support was supposedly added through this issue #992 and related merge request #993.

Though I still get this issue.

With following test.md

![](./image.png){fig-alt="Some image"}

I get

test.md:2:1 MD045/no-alt-text Images should have alternate text (alt text) https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md045.md

after running

markdownlint-cli2 test.md

MD045 supports CommonMark syntax for image alternate text (technically the "image description") and the PR referenced above allowed the rule to also recognize alternate text in an HTML IMG tag via the ALT attribute. There are examples of both in the documentation: https://github.com/DavidAnson/markdownlint/blob/main/doc/md045.md

What's shown above in this issue as "fig-alt" is neither of those and therefore not recognized. It looks like this is something Quarto does because it does not use the image description in the standard way: https://quarto.org/docs/authoring/figures.html#alt-text

Quarto’s custom format does not work well with CommonMark syntax as it parses like content and is displayed to the user: https://dlaa.me/markdownlint/#%25m%23%20Issue%201200%0A%0A!%5BElephant%5D(elephant.png)%7Bfig-alt%3D%22A%20drawing%20of%20an%20elephant.%22%7D%0A