diff --git a/ci/edmtool.py b/ci/edmtool.py index 30d328591..8f75f84f2 100644 --- a/ci/edmtool.py +++ b/ci/edmtool.py @@ -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( diff --git a/docs/source/conf.py b/docs/source/conf.py index 6aa8ffc90..72c2ac29b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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", ] @@ -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 # ----------------------- diff --git a/enable/__init__.py b/enable/__init__.py index 9cc0aa19c..2a8ad63a5 100644 --- a/enable/__init__.py +++ b/enable/__init__.py @@ -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