diff --git a/docs/conf.py b/docs/conf.py index e593a3a3..719a2217 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -33,6 +33,7 @@ "sphinx.ext.viewcode", "sphinx.ext.intersphinx", "sphinx.ext.githubpages", + "sphinx_copybutton", ] templates_path = ["_templates"] @@ -57,6 +58,14 @@ html_favicon = html_logo html_static_path = ["_static"] +# -- Extension - CopyButton - Configuration ---------------------------------- + +# https://sphinx-copybutton.readthedocs.io/en/latest/use.html#using-regexp-prompt-identifiers +copybutton_prompt_text = r">>> |\.\.\. |\$ |\$\w|In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " +copybutton_prompt_is_regexp = True +# https://sphinx-copybutton.readthedocs.io/en/latest/use.html#honor-here-document-syntax-when-copying-multiline-snippets +copybutton_here_doc_delimiter = "EOT" + # -- Fetch image references -------------------------------------------------- # Download all of the image files referenced in images.toml diff --git a/docs/requirements.txt b/docs/requirements.txt index 906e596b..d513863f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,4 +8,5 @@ requests==2.32.5 #breathe==4.31.0 #sphinxcontrib-svg2pdfconverter==1.1.1 #sphinxcontrib-mermaid==0.8.1 +sphinx-copybutton>=0.5.2 furo>=2025.9.25 diff --git a/pyproject.toml b/pyproject.toml index 06752380..d60aa414 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,14 +69,14 @@ dynamic = ["version"] [dependency-groups] test = ["pytest"] dev = ["build", "pre-commit"] -docs = ["sphinx", "myst-parser", "furo>=2025.9.25"] +docs = ["sphinx", "myst-parser", "furo>=2025.9.25", "sphinx-copybutton>=0.5.2"] [project.optional-dependencies] macho = ["lief==0.17.1"] java = ["javatools>=1.6,==1.*"] test = ["pytest", "pytest-asyncio"] dev = ["build", "pre-commit"] -docs = ["sphinx", "myst-parser", "furo>=2025.9.25"] +docs = ["sphinx", "myst-parser", "furo>=2025.9.25", "sphinx-copybutton>=0.5.2"] [project.scripts] surfactant = "surfactant.__main__:main" @@ -88,8 +88,6 @@ Documentation = "https://surfactant.readthedocs.io/en/latest/" "Issue Tracker" = "https://github.com/LLNL/Surfactant/issues" "Source Code" = "https://github.com/LLNL/Surfactant" - - [tool.setuptools.packages.find] include = ["surfactant", "surfactant.*"]