[GH-ISSUE #1200] MD045: no-alt-text triggered even though html alt-text is specified #639

Closed
opened 2026-03-03 01:28:40 +03:00 by kerem · 2 comments
Owner

Originally created by @skwde on GitHub (May 7, 2024).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1200

It seems that this should no longer appear, because support was supposedly added through this issue https://github.com/DavidAnson/markdownlint/issues/992 and related merge request https://github.com/DavidAnson/markdownlint/pull/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
Originally created by @skwde on GitHub (May 7, 2024). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1200 It seems that this should no longer appear, because support was supposedly added through this issue https://github.com/DavidAnson/markdownlint/issues/992 and related merge request https://github.com/DavidAnson/markdownlint/pull/993. Though I still get this issue. With following `test.md` ```md ![](./image.png){fig-alt="Some image"} ``` I get ```out 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 ```sh markdownlint-cli2 test.md ```
kerem 2026-03-03 01:28:40 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (May 7, 2024):

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

<!-- gh-comment-id:2098838472 --> @DavidAnson commented on GitHub (May 7, 2024): MD045 supports CommonMark syntax for image alternate text (technically the ["image description"](https://spec.commonmark.org/0.31.2/#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
Author
Owner

@DavidAnson commented on GitHub (May 7, 2024):

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

<!-- gh-comment-id:2098848893 --> @DavidAnson commented on GitHub (May 7, 2024): 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
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#639
No description provided.