-
Notifications
You must be signed in to change notification settings - Fork 85
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
Improve function handling #683
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great - excellent improvement! Please do not merge until we've finished regenerating all historical API docs with prior queued changes.
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
0451642
to
99ccc68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💜 This will be ready to merge once Arnau puts up the last PR for Qiskit 0.19.
scripts/lib/api/processHtml.test.ts
Outdated
doc.expectHtml(`<strong>Example</strong> | ||
<strong>Examples</strong> | ||
<strong>References</strong> | ||
<h2>Reference</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be <strong>
because it's "member-specific", similar to an example. Rather than signifying the start of a new section with its own "code members", this is only added info about the current member.
All Qiskit versions have been regenerated so this can be merged when you both think it's ready 👍. Thank you so much @frankharkins for waiting! |
You'll need to regenerate the Qiskit 0.45 docs. You can run this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Arnau is working on automating regeneration of historical API docs. So he can help with applying this fix to the historical docs.
Great job with this! Huge improvement.
- Restore `_package.json` that was accidentally deleted in #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>
- Restore `_package.json` that was accidentally deleted in Qiskit#683
This PR improves how the API generation script handles functions.
Changes
Demote some
h2
tags tostrong
We currently convert all
.rubric
elements toh2
, but this makes some headings higher-level than they should be (specifically "Example" and "References" headings). For an example see api/qiskit/converters.This PR converts rubrics to
strong
(rather thanh2
) 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.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 useh2
).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).
One quirk with this I spotted was some function names not appearing in the sidebar in
/api/qiskit/utils
(seeadd_deprecation_to_docstring
in the screenshot). This is possibly because the title hierarchy skipsh2
.Closes #231