Skip to content

Add sphinx_copybutton to provide copy button for code blocks on readthedocs - #96

Open
sipke wants to merge 1 commit into
OpenAMP:mainfrom
sipke:feature/sphinx-copybutton-extension
Open

Add sphinx_copybutton to provide copy button for code blocks on readthedocs#96
sipke wants to merge 1 commit into
OpenAMP:mainfrom
sipke:feature/sphinx-copybutton-extension

Conversation

@sipke

@sipke sipke commented Aug 31, 2026

Copy link
Copy Markdown

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.

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
arnopo requested review from edmooring and tnmysh August 31, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants