Skip to content

Commit

Permalink
Add "copy" button to the sphinx documentation page. (#609)
Browse files Browse the repository at this point in the history
### Description

Following https://sphinx-copybutton.readthedocs.io/en/latest/ to add a
little “copy” button to the right of the code blocks. Added
`sphinx_copybutton` extension in conf.py.

Tested in local build (`make html`) and it works fine, but I'm not sure
if the `sphinx_copybutton` extension is available on the server where
the website HTML is built.

### Checklist
_Before this pull request can be reviewed, all of these tasks should be
completed. Denote completed tasks with an `x` inside the square brackets
`[ ]` in the Markdown source below:_
- [x] I have added a description (see above).
- [x] I have added a link to any related issues see (see above).
- [x] I have read the [Contributing
Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md).
- [ ] I have added tests for any new physics that this PR adds to the
code.
- [x] I have tested this PR on my local computer and all tests pass.
- [ ] I have manually triggered the GPU tests with the magic comment
`/azp run`.
- [x] I have requested a reviewer for this PR.

---------

Co-authored-by: Ben Wibking <ben@wibking.com>
  • Loading branch information
chongchonghe and BenWibking authored May 28, 2024
1 parent 4c1a576 commit ba38740
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
.github/workflows/dependencies/documentation.sh
python3 -m pip install --upgrade pip
python3 -m pip install sphinx==5.3.0 sphinx_rtd_theme sphinxcontrib_bibtex
python3 -m pip install sphinx==5.3.0 sphinx_rtd_theme sphinxcontrib_bibtex sphinx-copybutton
- name: Install and Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ cd docs

echo "Build the Sphinx documentation for Quokka."
#make PYTHON="python3" LATEXMKOPTS="-interaction=nonstopmode" latexpdf
make PYTHON="python3" html &> make_source_html.out
make PYTHON="python3" html
cd ../
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [ "sphinxcontrib.bibtex" ]
extensions = [ "sphinxcontrib.bibtex", "sphinx_copybutton" ]

bibtex_bibfiles = ["references.bib"]
#bibtex_default_style = "plain"
Expand Down
8 changes: 5 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
breathe==4.31
sphinx==4.2.0
sphinxcontrib_bibtex==2.4.1
sphinx==5.3.0
sphinxcontrib_bibtex==2.6.2
sphinx-copybutton==0.5.2
breathe==4.35.0
sphinx_rtd_theme==2.0.0

0 comments on commit ba38740

Please sign in to comment.