-
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
API generation script uses MDX components #1026
API generation script uses MDX components #1026
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.
👏
Part of #1008 This PR is a precursor of #1026, and it creates a new script named `generateApiComponents.ts` with some tests. This script will have all the logic to generate the MDX components, but, in the meantime, this PR adds some functions that can be tested independently by just receiving, as parameters, a list of props or HTML code. It also copies over the functions `prepareGitHubLink` and `findByText` from `processHtml.ts`
Thanks for contributing to Qiskit documentation! Before your PR can be merged, it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. Thanks! 🙌 |
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.
🚀
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Turns out the math blocks (latex expressions between double dollars `$$`) can't be indented more than once without making the pages not render. After introducing the MDX components for classes, functions, and attributes on #1026, we can't guarantee only one level of indentation, and this PR adds a new function to remove the indentation as a postprocess of all the MDX files. Example of a math expression that was not rendering before: ![Captura desde 2024-04-03 23-35-05](https://github.com/Qiskit/documentation/assets/47946624/b3ecfb8d-b7c7-40c6-84b1-da0965ec0c15)
Closes #1120 This PR changes the script to use the `name` extracted from the `signature` of the attributes instead of using the `id` to create the `<h3>`s. This behavior was changed in #1026, but It broke a couple of headings. It also fixes two attributes of `qiskit.algorithms.eigensolvers.VQD` manually modifying the artifacts stored in [Box](https://ibm.ent.box.com/folder/246867452622?s=tqmvw6ldivzkhh934nhufan4rg3dregr) for versions 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45 and 0.46. See more at #1120
Part of Qiskit#1008 This PR is a precursor of Qiskit#1026, and it creates a new script named `generateApiComponents.ts` with some tests. This script will have all the logic to generate the MDX components, but, in the meantime, this PR adds some functions that can be tested independently by just receiving, as parameters, a list of props or HTML code. It also copies over the functions `prepareGitHubLink` and `findByText` from `processHtml.ts`
Part of Qiskit#1008 This PR teaches our API generation script to generate MDX components that will define the styling of the classes, properties, attributes, methods, functions, and exceptions. The script will generate custom tags to wrap all the content and store useful information as props. This is an example of git diff for an Attribute: ```diff - ### dtm - Return the system time resolution of output signals :returns: The output signal timestep in seconds. :rtype: dtm + ### dtm + <Attribute id="qiskit_ibm_provider.IBMBackend.dtm" name="dtm"> + Return the system time resolution of output signals :returns: The output signal timestep in seconds. :rtype: dtm + </Attribute> ``` The script continues generating headers for every apiType that needs it, but this will be removed in a follow-up. ### Details The PR adds a new script named `generateMdxComponents.ts` that will generate all the components. The main function is `processMdxComponent` where we prepare the necessary props for each component and then return an open tag and a closed tag ready for its use. To process the new tags, new handlers have been added to `htmlToMd.ts`. --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Part of Qiskit#1008 This PR regenerates qiskit-ibm-runtime API with the design changes introduced in Qiskit#1026
Part of Qiskit#1008 This PR regenerates qiskit-ibm-provider API with the design changes introduced in Qiskit#1026
Part of Qiskit#1008 This PR regenerates qiskit API with the design changes introduced in Qiskit#1026
Turns out the math blocks (latex expressions between double dollars `$$`) can't be indented more than once without making the pages not render. After introducing the MDX components for classes, functions, and attributes on Qiskit#1026, we can't guarantee only one level of indentation, and this PR adds a new function to remove the indentation as a postprocess of all the MDX files. Example of a math expression that was not rendering before: ![Captura desde 2024-04-03 23-35-05](https://github.com/Qiskit/documentation/assets/47946624/b3ecfb8d-b7c7-40c6-84b1-da0965ec0c15)
Closes Qiskit#1120 This PR changes the script to use the `name` extracted from the `signature` of the attributes instead of using the `id` to create the `<h3>`s. This behavior was changed in Qiskit#1026, but It broke a couple of headings. It also fixes two attributes of `qiskit.algorithms.eigensolvers.VQD` manually modifying the artifacts stored in [Box](https://ibm.ent.box.com/folder/246867452622?s=tqmvw6ldivzkhh934nhufan4rg3dregr) for versions 0.39, 0.40, 0.41, 0.42, 0.43, 0.44, 0.45 and 0.46. See more at Qiskit#1120
Part of #1008
This PR teaches our API generation script to generate MDX components that will define the styling of the classes, properties, attributes, methods, functions, and exceptions.
The script will generate custom tags to wrap all the content and store useful information as props. This is an example of git diff for an Attribute:
The script continues generating headers for every apiType that needs it, but this will be removed in a follow-up.
Details
The PR adds a new script named
generateMdxComponents.ts
that will generate all the components. The main function isprocessMdxComponent
where we prepare the necessary props for each component and then return an open tag and a closed tag ready for its use.To process the new tags, new handlers have been added to
htmlToMd.ts
.