Require alternative text for images.
Providing alternative text for images is essential for accessibility. Without alternative text, users who rely on screen readers or other assistive technologies won't be able to understand the content of images. This rule helps catch cases where alternative text is missing or contains only whitespace.
This rule warns when it finds images that either don't have alternative text or have only whitespace as alternative text.
This rule does not warn when:
- An HTML image has an empty alt attribute (
alt="") - An HTML image has the
aria-hidden="true"attribute
Examples of incorrect code:
<!-- eslint markdown/require-alt-text: "error" -->


![][ref]
[ref]: sunset.png
<img src="sunset.png">
<img src="sunset.png" alt=" ">Examples of correct code:
<!-- eslint markdown/require-alt-text: "error" -->

![Company logo][logo]
[logo]: logo.png
<img src="sunset.png" alt="">
<img src="sunset.png" alt="A beautiful sunset">
<img src="decorative.png" aria-hidden="true">If you aren't concerned with image accessibility or if your images are purely decorative and don't convey meaningful content, you can safely disable this rule.