Skip to content
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

Merged
merged 29 commits into from
Apr 3, 2024

Conversation

arnaucasau
Copy link
Collaborator

@arnaucasau arnaucasau commented Mar 13, 2024

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:

- ### 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.

scripts/lib/api/processHtml.ts Outdated Show resolved Hide resolved
scripts/lib/api/processHtml.ts Show resolved Hide resolved
@arnaucasau arnaucasau changed the title [WIP] API generation script uses Function MDX component [WIP] API generation script uses MDX components Mar 19, 2024
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

scripts/lib/api/htmlToMd.ts Outdated Show resolved Hide resolved
scripts/lib/api/htmlToMd.ts Outdated Show resolved Hide resolved
scripts/lib/api/htmlToMd.ts Outdated Show resolved Hide resolved
scripts/lib/api/htmlToMd.ts Outdated Show resolved Hide resolved
scripts/lib/api/htmlToMd.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
scripts/lib/api/generateMdxComponents.ts Outdated Show resolved Hide resolved
github-merge-queue bot pushed a commit that referenced this pull request Mar 25, 2024
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`
@arnaucasau arnaucasau changed the title [WIP] API generation script uses MDX components API generation script uses MDX components Mar 27, 2024
@qiskit-bot
Copy link
Contributor

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! 🙌

Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

scripts/lib/api/mergeClassMembers.ts Outdated Show resolved Hide resolved
scripts/lib/api/mergeClassMembers.ts Outdated Show resolved Hide resolved
arnaucasau and others added 2 commits April 3, 2024 15:52
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
@arnaucasau arnaucasau added this pull request to the merge queue Apr 3, 2024
Merged via the queue into Qiskit:main with commit 2f21b3b Apr 3, 2024
2 checks passed
@arnaucasau arnaucasau deleted the AC/generate-Function-component branch April 3, 2024 14:39
github-merge-queue bot pushed a commit that referenced this pull request Apr 3, 2024
Part of #1008

This PR regenerates qiskit-ibm-runtime API with the design changes
introduced in #1026
github-merge-queue bot pushed a commit that referenced this pull request Apr 3, 2024
Part of #1008

This PR regenerates qiskit-ibm-provider API with the design changes
introduced in #1026
github-merge-queue bot pushed a commit that referenced this pull request Apr 3, 2024
Part of #1008

This PR regenerates qiskit API with the design changes introduced in
#1026
github-merge-queue bot pushed a commit that referenced this pull request Apr 4, 2024
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)
github-merge-queue bot pushed a commit that referenced this pull request Apr 10, 2024
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
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
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`
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
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>
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
Part of Qiskit#1008

This PR regenerates qiskit-ibm-runtime API with the design changes
introduced in Qiskit#1026
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
Part of Qiskit#1008

This PR regenerates qiskit-ibm-provider API with the design changes
introduced in Qiskit#1026
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
Part of Qiskit#1008

This PR regenerates qiskit API with the design changes introduced in
Qiskit#1026
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
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)
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
3 participants