Add sphinx_copybutton to provide copy button for code blocks on readthedocs - #96
Open
sipke wants to merge 1 commit into
Open
Add sphinx_copybutton to provide copy button for code blocks on readthedocs#96sipke wants to merge 1 commit into
sipke wants to merge 1 commit into
Conversation
sphinx does not by default provide a code block copy button as does github and many IDEs, but this can be enabled by including the sphinx_copybutton extension. Signed-off-by: Sipke Vriend <sipke@direktembedded.com>
arnopo
approved these changes
Aug 31, 2026
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sphinx does not by default provide a code block copy button as does github and many IDEs, but this can be enabled by including the sphinx_copybutton extension.
This PR adds the extension to the conf file and the requirements.txt file to ensure it is installed before build.
This change was added as part of modifying code blocks to use shell block
OpenAMP/open-amp#697
OpenAMP/libmetal#369
OpenAMP/openamp-system-reference#118
so makes most sense to merge after those are fixed, but technically can be merged independently. If merged independently it would just mean when someone used the copy button it
will copy the leading prompt ($) as well until the other git submodules are merged.
For an example, hover over one of the code blocks on this page
https://openamp--96.org.readthedocs.build/en/96/openamp-system-reference/examples/legacy_apps/examples/echo/README.html
and notice the copy button appear on top right of block.