From de38160351ba75b36df941cddbac18a1dcc6038c Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 24 Jan 2022 14:55:14 +0100 Subject: [PATCH] docs: add the copybutton extension to sphinx --- docs/requirements.txt | 1 + docs/source/conf.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index d00e05a845..2d4f477f06 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,6 +3,7 @@ sphinx>=3.4.3,<4.0 sphinx_rtd_theme>=0.5.2 # sphinx_tabs v1.2.1 is required for Sphinx 2 sphinx_tabs>=1.2.1 +sphinx_copybutton javalang beautifulsoup4 lxml diff --git a/docs/source/conf.py b/docs/source/conf.py index 966f3fae4d..ee7c97197b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -54,6 +54,7 @@ extensions = [ 'sphinx.ext.intersphinx', 'sphinx.ext.autosummary', 'sphinx_tabs.tabs', + 'sphinx_copybutton', 'javasphinx', 'showfile', ] @@ -64,6 +65,10 @@ todo_include_todos = True breathe_projects = {'simgrid': '../build/xml'} breathe_default_project = "simgrid" +# Setup the copybutton extension +copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " +copybutton_prompt_is_regexp = True + # Generate a warning for all a cross-reference (such as :func:`myfunc`) that cannot be found nitpicky = True nitpick_ignore = [ -- 2.20.1