-
Notifications
You must be signed in to change notification settings - Fork 87
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
Provider and Runtime show modules as top-level in sidebar #561
Conversation
2ffd6e7
to
181527f
Compare
181527f
to
ca0aeb8
Compare
ca0aeb8
to
eee79ac
Compare
@@ -0,0 +1,66 @@ | |||
--- |
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 used to be /index
. It is the API page for the top-level module.
@@ -1,66 +1,16 @@ | |||
--- |
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 used to be ibm-provider.md
(with -
, not _
). The only change we've made is the front matter / metadata.
"docs/start/__migration-guide-algorithms.md", | ||
"docs/start/__migration-guide-opflow.md", | ||
"docs/start/__migration-guide-qi.md", |
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.
These files don't exist anymore.
tocOptions: { | ||
collapsed: true, | ||
nestModule(id: string) { | ||
return id.split(".").length > 2; | ||
}, | ||
}, |
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 is now the universal behavior.
@@ -20,7 +20,14 @@ export function addFrontMatter<T extends SphinxToMdResult>( | |||
): void { | |||
for (let result of results) { | |||
let markdown = result.markdown; | |||
if (result.meta.python_api_name) { | |||
if (result.meta.hardcoded_frontmatter) { |
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.
The order of this if
matters. If you hardcode the frontmatter, we use that no matter what. That will be important when we fix #66 to add a fallback like using the filename. We want to make sure we still use the hardcoded metadata for these two index files.
test("generate a toc", () => { | ||
const toc = generateToc(pkg, [ | ||
{ meta: {}, url: "/docs/runtime" }, |
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.
I changed this test to better reflect reality.
`); | ||
}); | ||
|
||
test("nest modules", () => { |
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 test isn't necessary anymore since the nesting behavior is now consistent. The above test should cover 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.
Looks good to me! Thank you Eric!
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.
Thanks!
Will the navbar need updating? Clicking API reference > Qiskit IBM Runtime Client
still takes me to "Overview"
Is this the staging preview? That image is super out of date and we've had issues updating it. In production, the URL from the top nav bar is https://docs.quantum.ibm.com/api/qiskit-ibm-runtime and it takes you to the correct |
Closes Qiskit#558. Before: <img width="248" alt="Screenshot 2023-12-29 at 1 38 50 PM" src="https://github.com/Qiskit/documentation/assets/14852634/299bd13b-e681-4105-93b6-9525312c547a"> After: <img width="251" alt="Screenshot 2023-12-29 at 1 39 08 PM" src="https://github.com/Qiskit/documentation/assets/14852634/21c900af-b44c-4c69-9ac5-133bbc251b00"> This new left sidebar layout aligns with Qiskit. The consistency is useful, but also I think this new layout is more functional anyways. It reduces the amount of nesting. It also allows us to collapse the left sidebar by default, which we do in the rest of the docs. ## Changes index page Before, the index page was the description for the code components belonging to the top-level modules `qiskit_ibm_provider` and `qiskit_ibm_runtime`, rather than enumerating what all the modules are: Before: <img width="625" alt="Screenshot 2023-12-29 at 1 40 19 PM" src="https://github.com/Qiskit/documentation/assets/14852634/c2e08d6f-365e-4775-8719-c6aad01cc77a"> After: <img width="658" alt="Screenshot 2023-12-29 at 1 41 30 PM" src="https://github.com/Qiskit/documentation/assets/14852634/4a58cdd7-48f3-4e28-a0e4-cb716f095e4e"> Note that this index page is not accessible from the left sidebar; it's not clear what we would call it. But you can access it from the top nav-bar: <img width="234" alt="Screenshot 2023-12-29 at 1 42 13 PM" src="https://github.com/Qiskit/documentation/assets/14852634/4c9ebdd7-9bf2-45ed-8c3b-b998d319d5ec"> ## Metadata The new index pages have never had metadata. That's because we don't have any technique to determine from Sphinx programatically its metadata because the Sphinx generated HTML page is missing it: https://github.com/Qiskit/documentation/blob/60c836afbf30729fa30a97086b5812b08970ded5/scripts/lib/sphinx/PythonObjectMeta.ts#L13-L24 This is an instance of Qiskit#66. I think we need a generic solution to that problem, such as Axel's suggestion to use filenames as a fallback. But, it's important that the metadata is high quality for these two index pages since they are so high-profile. So, I propose hardcoding the metadata for them. Because there are only two files, I think this approach is acceptable; obviously it wouldn't scale if we were hardcoding dozens of files.
Closes #558.
Before:
After:
This new left sidebar layout aligns with Qiskit. The consistency is useful, but also I think this new layout is more functional anyways. It reduces the amount of nesting. It also allows us to collapse the left sidebar by default, which we do in the rest of the docs.
Changes index page
Before, the index page was the description for the code components belonging to the top-level modules
qiskit_ibm_provider
andqiskit_ibm_runtime
, rather than enumerating what all the modules are:Before:
After:
Note that this index page is not accessible from the left sidebar; it's not clear what we would call it. But you can access it from the top nav-bar:
Metadata
The new index pages have never had metadata. That's because we don't have any technique to determine from Sphinx programatically its metadata because the Sphinx generated HTML page is missing it:
https://github.com/Qiskit/documentation/blob/92b3fa45c10aa917c3fbc7ada861b2db55203902/scripts/lib/sphinx/PythonObjectMeta.ts#L13-L24
This is an instance of #66. I think we need a generic solution to that problem, such as Axel's suggestion to use filenames as a fallback. But, it's important that the metadata is high quality for these two index pages since they are so high-profile.
So, I propose hardcoding the metadata for them. Because there are only two files, I think this approach is acceptable; obviously it wouldn't scale if we were hardcoding dozens of files.