Skip to content

Commit

Permalink
Use the "sphinx-copybutton" extension in documentation (#948)
Browse files Browse the repository at this point in the history
* DOC: Use the sphinx-copybutton extension in documentation

	modified:   ci/edmtool.py
	modified:   docs/source/conf.py
	modified:   enable/__init__.py

* Update ci/edmtool.py
  • Loading branch information
Poruri Sai Rahul authored Jun 13, 2022
1 parent 8abaa17 commit 855106c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions ci/edmtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def docs(runtime, toolkit, environment):
])
commands = [
"edm install -y -e {environment} " + packages,
"edm run -e {environment} -- python -m pip install sphinx-copybutton",
]
click.echo(
"Installing documentation tools in '{environment}'".format(
Expand Down
7 changes: 7 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"sphinx.ext.napoleon",
# Link to code in sphinx generated API docs
"sphinx.ext.viewcode",
"sphinx_copybutton",
# Include trait definition comments in autogenerated API docs
"traits.util.trait_documenter",
]
Expand Down Expand Up @@ -98,6 +99,12 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# Options for Sphinx copybutton extension
# ---------------------------------------

# Matches prompts - "$ ", ">>>" and "..."
copybutton_prompt_text = r">>> |\.\.\. |\$ "
copybutton_prompt_is_regexp = True

# Options for HTML output
# -----------------------
Expand Down
2 changes: 2 additions & 0 deletions enable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
]

__extras_require__ = {
# Dependencies for documentation
"docs": ["enthought-sphinx-theme", "sphinx", "sphinx-copybutton"],
# Dependencies for running enable/kiva's examples
"examples": ["chaco", "mayavi", "scipy", "kiwisolver", "pyglet"],
# Dependencies for GL backend support
Expand Down

0 comments on commit 855106c

Please sign in to comment.