mystmd icon indicating copy to clipboard operation
mystmd copied to clipboard

⚠️ Add warnings for missing alt-text and auto-generated alt-text

Open JimMadge opened this issue 10 months ago • 13 comments

This PR adds two warnings with rules allowing them to be disabled,

  • Warning for images missing alt-text (image-has-alt-text)
  • Warning for images where alt-text was auto-generated, by checking for the altTextIsAutoGenerated tag (image-alt-text-generated)

Example output,

> npx myst build -d
...
⚠️  index.md missing alt text for ./cat1.jpg
To suppress this message, add rule: "image-has-alt-text" to "error_rules" in your project config
⚠️  index.md alt text for ./cat2.jpg was auto-generated
   You can remove this warning by writing your own alt text
To suppress this message, add rule: "image-alt-text-generated" to "error_rules" in your project config
...

I have a example project to test this, but haven't added a test here.

JimMadge avatar Jan 24 '25 16:01 JimMadge