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.
Fix header hierarchy for the API docs (Qiskit#1283)
The PR adds a method to autogenerate the correct level for the headers of the MDX components (Attribute, Function, and Class) and regenerates the API docs. ### How to find the heading level Before setting the header, the script looks for the level of the previous header to determine which one corresponds to the component that is being generated. The script looks at all the siblings of the `Cheerio` element we use to define the component to find the previous header that wasn't created by the script before. We need to skip the generated headers to avoid the case where we have multiple methods/attributes/classes at the same level which shouldn't be mixed with the header of the previous level. If there's no header found in the first step, it means that we are dealing with a component inside of an inline class, and therefore, the script searches for the last header that corresponds to an inline class to determine the new level. This is true because when we are inside an inline class, there are no headers that haven't been generated by the script. Notice that the script always sets the header of an inline class in the parent level instead of creating another sibling, so we cannot search for generated siblings' headers. To distinguish between the headers of the different components, an attribute called `data-header-type` is used. This attribute is useful in the last search. Closes Qiskit#1215 --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
- Loading branch information
1 parent
9c5a5c4
commit 6f82514
Showing
138 changed files
with
2,236 additions
and
1,326 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 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.