github / accessibility-alt-text-bot

An action to remind users to add alt text on Issues, Pull Requests, and Discussions
MIT License
74 stars 13 forks source link

Ignore images in code snippets #30

Closed kendallgassner closed 11 months ago

kendallgassner commented 1 year ago

If a user adds an image in a code snippet, we should ignore the alt text.

<img alt='' src='' /> 
github-actions[bot] commented 1 year ago

Uh oh! @kendallgassner, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

github-actions[bot] commented 1 year ago

Uh oh! @kendallgassner, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

khiga8 commented 1 year ago

This ties to https://github.com/github/accessibility-alt-text-bot/issues/28, which I believe is raising a false positive due to the code snippet in the release notes.

I think the long term solution is going to be to use a markdown parser like markdownlint to parse the markdown body and raise errors, rather than regex matching the string with bash like we currently do. This would be a pretty big overhaul of the code, but we do have existing markdownlint rules we could use in markdownlint-github.