Update MD045/no-alt-text to report instances of HTML "img" tags missing an "alt" attribute (fixes #992).

This commit is contained in:
Kate Higa 2023-10-18 23:20:19 -07:00 committed by GitHub
parent 0afedaebf4
commit 531e58ed9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 274 additions and 25 deletions

View file

@ -28,5 +28,43 @@ Multi-line image with alternate text ![Alternate text](image.jpg "Title"
Multi-line image without alternate text ![](image.jpg "Title"
) {MD045:28}
<!-- markdownlint-disable no-inline-html -->
Image tag with alt attribute set to text
<img src="image.png" alt="Descriptive text" />
Image tag with alt attribute not set
<img src="image.png" alt> {MD045}
Image tag with alt attribute set to decorative with an empty double-quote string
<img src="image.png" alt="" />
Image tag with alt attribute set to decorative with an empty single-quote string
<img src="image.png" alt='' />
Image tag with no alt attribute <img src="image.png" /> {MD045}
Multi-line image tag with no alt text
<img
src="image.png"> {MD045:48}
Multi-line image tag with alt attribute not set
<img
src="image.png"
alt> {MD045:52}
Multi-line image tag with alt text
<img
src="image.png"
alt="Description"
>
Uppercase image tag with alt attribute set
<IMG SRC="cat.png" ALT="Descriptive text">
Uppercase image tag with no alt set <IMG SRC="cat.png" /> {MD045}
<!-- markdownlint-restore no-inline-html -->
[notitle]: image.jpg
[title]: image.jpg "Title"