From: Mike Bayer Date: Fri, 11 Mar 2022 18:40:16 +0000 (-0500) Subject: add copybutton X-Git-Tag: rel_2_0_0b1~434 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a48471f6482576ac50abab35ce4fa64c1f633b4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git add copybutton 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 --- diff --git a/doc/build/conf.py b/doc/build/conf.py index d5b0a8b11d..d6fc0642c9 100644 --- a/doc/build/conf.py +++ b/doc/build/conf.py @@ -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. diff --git a/doc/build/requirements.txt b/doc/build/requirements.txt index f3e40e01fd..c5871d2124 100644 --- a/doc/build/requirements.txt +++ b/doc/build/requirements.txt @@ -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