Skip to content

Commit

Permalink
fix(sphinx):New regex for copy-button #112
Browse files Browse the repository at this point in the history
Added ^.\d|^\d\d|^\d\d\d| to the regex so line numbers are removed from the
copy-button paste function.

closes #112
  • Loading branch information
imAsparky committed Jul 20, 2021
1 parent 345e441 commit 094e00c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/source/conf.py
Expand Up @@ -74,6 +74,15 @@
# sphinx-copybutton is a lightweight code-block copy button
# config options are here https://sphinx-copybutton.readthedocs.io/en/latest/
# This config removes Python Repl + continuation, Bash line prefixes,
# ipython and qtconsole + continuation, jupyter-console + continuation
copybutton_prompt_text = r"[0-9] |[0-9][0-9] |[0-9][0-9][0-9] |>>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
# ipython and qtconsole + continuation, jupyter-console + continuation and preceding line numbers
copybutton_prompt_text = (
r"^.\d|^\d\d|^\d\d\d|>>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
)
copybutton_prompt_is_regexp = True

# datalad download-url http://www.tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.pdf \
# --dataset . \
# -m "add beginners guide on bash" \
# -O books/bash_guide.pdf
# is correctly pasted with the following setting
copybutton_line_continuation_character = "\\"

0 comments on commit 094e00c

Please sign in to comment.