feat: bash input signs are no more parts of copy btn content #161
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.
Describe changes
This commit makes sure terminal input signs are no more parts of copy btn content in code blocks.
Verbose
Unfortunately, I failed to set up attaching
$
signs automatically as planned initially for two reasons:Quickly realised it was a bad idea since bash blocks may include not only bash commands, but output as well and
$
signs would be redundant and look weird.Lines with input starts with
function
token type whereas output tokens have token type ofplain
. I set up to attach$
sign to a beginning of a code line if it starts withfunction
, but It turned out this isn't an option as well: prism parser doesn't recognize such commands asbrew
,docker
,k6
etc, so lines starting with those wouldn't have$
sign and we have no capabilities to extend the dictionary.Given that, I came up with the following solution: we keep
$
signs in bash terminals, add them manually where we need it, but copy button would be stripped of every$
that is a first character of a code line.Side:
CodeGroup
component similarly how it was done on blog to prevent buggy behavior$
signs to bash blocks on Installation pageSteps to test
$
signs indicating the bash inputCopy
button, paste the buffer content$
chars were stripped from lines indeedReferences
Closes #158