-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a linter to check the images' alt text #43
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pull Request Test Coverage Report for Build 12259242824Details
💛 - Coveralls |
Eric-Arellano
approved these changes
Dec 3, 2024
Eric-Arellano
added
the
stable backport potential
Label for mergify to open a backport PR
label
Dec 16, 2024
mergify bot
pushed a commit
that referenced
this pull request
Dec 16, 2024
In order to meet the [IBM Accessibility Requirements](https://www.ibm.com/able/requirements/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: ``` 💔 Some images are missing the alt text Errors found in qiskit_ibm_runtime/fake_provider/__init__.py: - Error in line 34: .. plot:: Alt text is crucial for making documentation accessible to all users. It should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. When an image contains words that are important to understanding the content, the alt text should include those words as well. ``` 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:`. (cherry picked from commit c4f13ab)
mrossinek
pushed a commit
that referenced
this pull request
Dec 19, 2024
In order to meet the [IBM Accessibility Requirements](https://www.ibm.com/able/requirements/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: ``` 💔 Some images are missing the alt text Errors found in qiskit_ibm_runtime/fake_provider/__init__.py: - Error in line 34: .. plot:: Alt text is crucial for making documentation accessible to all users. It should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. When an image contains words that are important to understanding the content, the alt text should include those words as well. ``` 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:`. (cherry picked from commit c4f13ab) Co-authored-by: Arnau Casau <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
.