mystmd
mystmd copied to clipboard
⚠️ Add warnings for missing alt-text and auto-generated alt-text
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
altTextIsAutoGeneratedtag (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.