Skip to content
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 alt text to API docs #2408

Open
9 tasks
arnaucasau opened this issue Nov 29, 2024 · 0 comments
Open
9 tasks

Add alt text to API docs #2408

arnaucasau opened this issue Nov 29, 2024 · 0 comments
Labels
content 📄 needs triage 🤔 this issue needs to be prioritized by the docs team on hold ⏸️

Comments

@arnaucasau
Copy link
Collaborator

arnaucasau commented Nov 29, 2024

Issue

The API docs don't have alt text for their images, and we need to add it by modifying the Python files in the 9 APIs repos. Each repo has a linter that can be used to verify how many images fail to provide an alternative text.

Each repo's linter has an allowlist defined at the beginning of the script with a list of all the current files that contain an image without alt text. The linter can be found at tools/verify_image.py.

Instructions

  1. Go to the tools/verify_image.py script in each of the 9 APIs.
  2. Look at the ALLOWLIST_MISSING_ALT_TEXT list to find all the files with images without alt text.
  3. Remove the file you want to fix from the ALLOWLIST_MISSING_ALT_TEXT list.
  4. Open a terminal and go to the top-level folder of the repo.
  5. Run the script by executing python tools/verify_image.py to get all the images without alt text in the file.

Example of the output:

💔 Some images are missing the alt text

Errors found in qiskit_ibm_runtime/fake_provider/example.py:
- Error in line 34: .. plot::
- Error in line 55: .. image::
- Error in line 63: .. 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.

This means that the file qiskit_ibm_runtime/fake_provider/example.py has images defined in lines 34, 55, and 63 without alt text.

  1. Find the code lines in the file and add the option :alt: [your alt text] under the directive .. image:: or .. plot:: found in each line. The .. plot:: directive is sometimes used to run code that doesn't generate an image. In those cases the option :nofigs: should be added instead of :alt: [your alt text].
  2. Remove the filename from the ALLOWLIST_MISSING_ALT_TEXT list if all the images are fixed.

List of the API repos to check:

@javabster javabster added the needs triage 🤔 this issue needs to be prioritized by the docs team label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content 📄 needs triage 🤔 this issue needs to be prioritized by the docs team on hold ⏸️
Projects
Status: No status
Development

No branches or pull requests

2 participants