Remove >>> from code blocks
It's common to see code blocks like this:
>>> 1 + 1
2
The >>> is emulating a REPL like IPython. However, it's not very useful to our end users because they cannot use our copy-code button. Better is this:
print(1 + 1)
2
We should fix:
- [ ] guides
- [ ] migration-guides
- [ ] qiskit-ibm-runtime/dev
- [ ] qiskit/dev
Use rg '>>>' to find violations.
In Sphinx, you'd fix this with something like this:
.. code-block:: python
print(1 + 1)
.. code-block:: text
2
Hi, can you assigned me to this issue please?
Sure, @a-dubaj. Thanks for offering to help! It'd be great to focus on docs/guides and docs/migration-guides to start. The API docs are updated in other repositories and could be handled separately.
Hey @a-dubaj how is this going?
Hi @Eric-Arellano,
I'd like to work on this issue! My plan is to:
Search for all occurrences of >>> in the documentation using grep. Replace >>> with appropriate Python print() statements where needed. Ensure that modified examples remain correct and readable. Build the documentation locally to verify the changes. I'll submit a PR soon. Let me know if you have any suggestions or specific guidelines to follow. Thanks!
That would be much appreciated, @Gyan-max! I recommend starting with the qiskit/documentation repository (this one). Be careful not to change the docs/api folder because those docs are auto-generated, so your change will be reverted the next time we update the API docs.
grep
I recommend ripgrep https://github.com/BurntSushi/ripgrep :) One of the most useful CLI tools out there
ThankYou @Eric-Arellano for assigning this issue. I'm on it and will raise a PR asap.
Closed in https://github.com/Qiskit/documentation/pull/2698