FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-107024 Added copy button to code snippets in documentation by churnikov · Pull Request #107037 · python/cpython · GitHub

Repository navigation

gh-107024 Added copy button to code snippets in documentation - #107037

Closed
churnikov wants to merge 6 commits into
python:mainfrom
churnikov:gh-107024-copy-button
Closed

churnikov wants to merge 6 commits into
python:mainfrom
churnikov:gh-107024-copy-button

Conversation

churnikov commented Jul 22, 2023 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown

I added sphinx-copybutton to documentation dependencies, which results in the following button in code snippets

If this is a right thing to do, then this requires a bit more work, as this right now copies the whole code block, but it could be changed through configuration.
It also overrides >>> toggle button where applicable. This has to be fixed or decided to be dropped and made so that copy button copies code without >>> and output.


📚 Documentation preview 📚: https://cpython-previews--107037.org.readthedocs.build/

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

ghost commented Jul 22, 2023 •
edited by ghost
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

churnikov marked this pull request as ready for review July 23, 2023 11:21

AA-Turner commented Jul 27, 2023 •
edited
Loading

Copy link
Copy Markdown
Member

We could add this to python-docs-theme instead, to have all users of that theme benefit from this change? That would also enable making the necessary styling changes in one place.

A

Comment thread Doc/conf.py
'pyspecific',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx_copybutton',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We've been cautious about including third-party extensions, in case downstream redistributors haven't installed them. See the try/except block just below for sphinxext.opengraph.

All the others here are Sphinx builtin extensions, or our own custom ones.

sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
urllib3==1.26.15
sphinx-copybutton<0.6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This file is meant to be a generated list of pinned dependencies, see instructions at the top.

Comment thread Doc/requirements.txt
blurb

sphinxext-opengraph==0.7.5
sphinx-copybutton<0.6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why the upper version limit?

Copy link
Copy Markdown
Author

#107037 (comment)

Sure, I could do that if think that would be better

Copy link
Copy Markdown
Member

This has been implemented in python/python-docs-theme@d528dbc

This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL