[WIP] Adds Qiskit addon prose content pipeline #5046
Draft
eharvey328 wants to merge 109 commits into
Draft
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
axelhzf
reviewed
May 27, 2026
| @@ -587,8 +587,57 @@ function _qiskitCRegexes(): FilesToIgnores { | |||
| }; | |||
| } | |||
|
|
|||
| function _addonStaleTutorialLinks(): FilesToIgnores { | |||
Collaborator
There was a problem hiding this comment.
When this is merged, we should open an issue so we don't forget about this.
|
|
||
| // Generates the _toc.json for an addon's content pages. | ||
| // | ||
| // Addon TOCs have a fixed three-part shape: |
Collaborator
There was a problem hiding this comment.
How hard would be to process the html to extract the toc preserving the order, and ignore the entries that we are not including?
| "leftarrow", | ||
| "forall", | ||
| "arxiv", | ||
| "subpace", // fix in addon-sqd |
Collaborator
There was a problem hiding this comment.
Can we add an issue for this?
This file contains hidden or 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
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.
Extracts prose HTML and Jupyter notebooks for Qiskit addons and converts them to MDX to be consumed by our docs app.
The goal is to extend the existing API docs pipeline for minimal changes.
Adds a new addons command
npm run gen-addon -- -p {package}, to function like the existingnpm run gen-api -- -p {package} -v {version}Why a separate pipeline instead of reusing the API pipeline
runApiDocsPipeline) targetsapidocs/**stubs and generatesdocs/api/{pkg}/..ipynb) under the Sphinx root — no stubs, nohistorical versioning, no release notes per-page.
(
pipelineStages.ts,notebookStages.ts) but diverges in:apidocs/**,stubs/**docs/api/{pkg}/docs/addons/{pkg}/public/docs/images/api/public/docs/images/addons/generateToc.tsgenerateAddonToc.ts<h1>latest/historical/devlatestonlyNew files
scripts/js/lib/api/addonDocsPipeline.tsscripts/js/lib/api/pipelineStages.tsconversionPipeline.ts; used by both pipelinesscripts/js/lib/api/notebookStages.tsscripts/js/lib/api/generateAddonToc.ts_toc.jsonwith back-link, merged Guide sections, Tutorials, API referencescripts/js/commands/api/updateAddonDocs.ts--package,--versionscripts/js/commands/api/updateDocsShared.tsupdateApiDocs.tsscripts/js/lib/api/apiDocsPipeline.tsconversionPipeline.ts; API pipeline now lives hereDesign decisions
extractfrontMatter=truein addon pipeline: Addons don't follow the same URL-slug naming convention as API stubs, so URL-derived titles were wrong. Extracting from<h1>is more reliable.escapeMdxSpecialCharsin notebookStages: Opt-mapper notebooks contain math like0 <= x < 1in prose, which MDX parses as a JSX tag open. The function surgically escapes only bare<outside code/math regions rather than HTML-escaping the entire source.Merged "Guides" section in
generateAddonToc:how-tos/andexplanations/both map to "Guides" viaDIR_LABELS. This matches the Qiskit docs content model (guides = both types).parentLabel added to
_tocto provide text for the parent back arrow (link) in the toc. Added as a new property for backwards compatibility with learning content.Loading all
objects.invfiles for cross-package link resolution: Addon notebooks link to symbols in other packages (qiskit.github.io/{pkg}/stubs/...). The old pipeline only resolved links against the current package's inventory, which isn't enough for addons.ObjectsInv.loadPublishedApis(publicBaseFolder)first, which scanspublic/docs/api/on disk and returns aMap<pkgName, ObjectsInv>for every package that has a published inventory. That map flows down throughpostProcess→updateLinksandprocessNotebooks→rewriteNotebookLinks, whereresolveStubUrl(url, allInvs)uses it to look up the right package's inventory by name.resolveStubUrlhandles two URL forms:stubs/{Symbol}— entry lookup by name; the entry'surialready carries the correct anchor.apidocs/{page}— page-level lookup; the source#anchoris preserved and appended.std:domain guard inshouldIncludeEntry— excludes non-API entries (guide pages, index, install) from published inventories so they can't produce false cross-package matches.