Add a linter to check the images' alt text (backport #41) #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to meet the IBM Accessibility Requirements for the API docs, we need to ensure that all images have appropriate alt text so that users can understand any meaningful visuals. The alt text should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. In addition, if an image contains important words for understanding the content, the alt text should include those words as well.
This PR adds a linter to check that all images have alt text. The current invalid images, if any, have been included in an allowlist that will help us to not break CI before the text is added.
If the script detects an image without alt text, it will show an error indicating the file where the image is located and the line where we are using a sphinx directive like
.. image::
or.. plot::
that generates an image. Example:To fix the error, the
:alt: [Your text here]
option must be added under the lines indicated in the error messages. However, If the.. plot::
directive is used, but no image is generated, you can use the option:nofigs:
.This is an automatic backport of pull request #41 done by Mergify.