remove regex that breaks copy button #690
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #688
Problem
The bug preventing copying the full block text is due to this regular expression in
conf.py
:which does the following:
The current regex matches on the user and root shell prompts, so presumably this was originally meant to capture text from
console
orshell-session
blocks, but actually results in the copy button ignoring any useful text in blocks that contain a comment (except for the comment text).Investigating
I checked the directory for instances where we use a leading
#
character after opening a codeblock and found only these two files:Every instance in
packaging-existing-software.md
is a comment containing a filename, which doesn't break anything. Ininstalling-nixos-on-a-raspberry-pi.md
, we have several instances of the root prompt, including several commands run as root in the same codeblock, but nobody reading that tutorial will ever be using the copy button and pasting what they get into a console (I hope), so it should be fine to copy the#
in those cases, or the whole block in places where there are several commands, like here.The Fix
Remove the root prompt from the regex: