Closed melodywang060 closed 1 month ago
If you are showing a command and it's output it can help to add the $
to the beginning of the command which lets the console
syntax highlighter do it's thing.
```console
$ df -h
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk3s1s1 926Gi 19Gi 665Gi 3% 404k 4.3G 0% /
devfs 224Ki 224Ki 0Bi 100% 774 0 100% /dev
```console
$ df -h
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk3s1s1 926Gi 19Gi 665Gi 3% 404k 4.3G 0% /
devfs 224Ki 224Ki 0Bi 100% 774 0 100% /dev
My understanding is that the copy/paste button ignores the additional lines because it thinks they are command output. You can see the highlighting clearly using the console
highlighter.
$ gcloud container clusters create rapids-gpu-kubeflow \
--accelerator type=nvidia-tesla-a100,count=2 --machine-type a2-highgpu-2g \
--zone us-central1-c --release-channel stable
So removing the $
let's the copy/paste plugin know that it should copy the whole block.
gcloud container clusters create rapids-gpu-kubeflow \
--accelerator type=nvidia-tesla-a100,count=2 --machine-type a2-highgpu-2g \
--zone us-central1-c --release-channel stable
In any case in the docs where we have the leading $
but no example output then we are fine to just remove it. And for any single-line commands which have the $
things should work as expected. The only case I'm worried about it a multi-line command that does have output, in which case I don't think we can get the copy/paste to behave correctly. Hopefully there aren't any of those!
Interestingly the GitHub copy/paste button doesn't do anything clever at all and just copies the whole box, which probably isn't what you want for console
examples with output.
Interestingly the GitHub copy/paste button doesn't do anything clever at all and just copies the whole box, which probably isn't what you want for console examples with output.
I think it was this experience on GitHub specifically that probably led me to form this aversion to the leading $
. To be fair, I didn't realize it was GitHub-specific.
Thanks for all the examples @jacobtomlinson ! Given that, I support what you said:
$
$
$
Problem
In a lot of code chunks in RAPIDs deployment documentation, only the first line of the multiline command is copied over when users hit the copy code block button - the rest are omitted
Example:
In the example above, only the first line is interpret as the command, and the following lines are interpreted as the console output from the command in the first line
Quick Fix
Removing the
$
in the beginning of the code chunkThis interprets the multiline command as a whole block of code to copy over instead of just the first line.
Pros