forked from Qiskit/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve function handling (Qiskit#683)
This PR improves how the API generation script handles functions. ## Changes ### Demote some `h2` tags to `strong` We currently convert all `.rubric` elements to `h2`, but this makes some headings higher-level than they should be (specifically "Example" and "References" headings). For an example see [api/qiskit/converters](https://docs.quantum.ibm.com/api/qiskit/converters). <img width="197" alt="Screenshot 2024-01-23 at 17 37 33" src="https://github.com/Qiskit/documentation/assets/36071638/618a256b-9bdf-481b-bb49-e3eea7476b8e"> This PR converts rubrics to `strong` (rather than `h2`) if the name is "Example(s)" or "Reference(s)". This is a bit hacky, but it seems to work and I can't think of a better way of doing it. The Sphinx LaTeX writer also takes a [similar approach](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-rubric). I've regenerated the docs using this new logic and I can see no false positives (that is, cases in which we use `strong` where we should use `h2`). ### Add function names as headings Functions currently have no headings. This PR adds a `h3` with the function name, which improves readability, gives anchor tag icons, and will add more functions to the right sidebar. I've also included some logic to avoid adding function names when the page is already dedicated to the function (such as [least_busy](https://docs.quantum.ibm.com/api/qiskit-ibm-provider/qiskit_ibm_provider.least_busy)). One quirk with this I spotted was some function names not appearing in the sidebar in `/api/qiskit/utils` (see `add_deprecation_to_docstring` in the screenshot). This is possibly because the title hierarchy skips `h2`. ![Screenshot 2024-01-23 at 18 00 37](https://github.com/Qiskit/documentation/assets/36071638/c189dfc1-3535-4e2e-9edb-889ba855ef10) *** Closes Qiskit#231 --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
- Loading branch information
1 parent
3ae9e49
commit 5c14a74
Showing
147 changed files
with
926 additions
and
236 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.