Update MD045/no-alt-text to allow violations when an HTML IMG has aria-hidden set to true (fixes #1576).

This commit is contained in:
David Anson 2025-04-27 18:42:25 -07:00
parent faf96d513b
commit b611eba684
7 changed files with 70 additions and 4 deletions

View file

@ -42681,6 +42681,22 @@ Generated by [AVA](https://avajs.dev).
'no-alt-text',
],
},
{
errorContext: null,
errorDetail: null,
errorRange: [
24,
42,
],
fixInfo: null,
lineNumber: 75,
ruleDescription: 'Images should have alternate text (alt text)',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md045.md',
ruleNames: [
'MD045',
'no-alt-text',
],
},
],
fixed: `# Images with and without alternate text␊
@ -42752,6 +42768,18 @@ Generated by [AVA](https://avajs.dev).
<img src="image.png" /> {MD045}␊
</p>
No alt attribute is okay when the image is hidden from assistive technology:␊
<img src="image.png" aria-hidden="true"/>
<img src="image.png" ARIA-HIDDEN="TRUE" />
But not when disabled: <img src="image.png" aria-hidden="false"/> {MD045}␊
Multi-line image tag aria-hidden:␊
<img
src="image.png"␊
aria-hidden="true"␊
/>␊
<!-- markdownlint-restore no-inline-html -->
[notitle]: image.jpg␊