]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
add copybutton
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 11 Mar 2022 18:40:16 +0000 (13:40 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 11 Mar 2022 18:40:16 +0000 (13:40 -0500)
works great, including for plain code plus prompt code
with SQL (copies only the prompt code when prompts are present).
added some styling to zzzeeksphinx

Change-Id: I1b94b0488689e875adfb90ec171e04f7e8022415

doc/build/conf.py
doc/build/requirements.txt

index d5b0a8b11d9377773df94cca3d42cb4c7885fad3..d6fc0642c9c3d339eebddaefe1efe138ce8008bf 100644 (file)
@@ -36,6 +36,7 @@ extensions = [
     "zzzeeksphinx",
     "changelog",
     "sphinx_paramlinks",
+    "sphinx_copybutton",
 ]
 needs_extensions = {"zzzeeksphinx": "1.2.1"}
 
@@ -44,6 +45,12 @@ needs_extensions = {"zzzeeksphinx": "1.2.1"}
 # have reported this.
 templates_path = [os.path.abspath("templates")]
 
+# https://sphinx-copybutton.readthedocs.io/en/latest/use.html#strip-and-configure-input-prompts-for-code-cells
+copybutton_prompt_text = (
+    r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
+)
+copybutton_prompt_is_regexp = True
+
 nitpicky = False
 
 # The suffix of source filenames.
index f3e40e01fd9bc17389842cf5bb72ce259af5e0b5..c5871d2124187b6463855e59bfcaec32f1a71780 100644 (file)
@@ -1,3 +1,4 @@
 git+https://github.com/sqlalchemyorg/changelog.git#egg=changelog
 git+https://github.com/sqlalchemyorg/sphinx-paramlinks.git#egg=sphinx-paramlinks
 git+https://github.com/sqlalchemyorg/zzzeeksphinx.git#egg=zzzeeksphinx
+sphinx-copybutton
\ No newline at end of file