hatch
hatch copied to clipboard
Remove $ from command
Remove $ from command to easily paste in terminal without getting an error. $ at the beginning gives an error.
For an actual complete solution I'd suggest to continue to use $
and ```console
consistently but just make the $
part non-selectable in the browser, by adding extra_css
like this:
.highlight .gp { /* Generic.Prompt */
user-select: none;
}
Oh interesting! Does that also affect the copy button?
Updating https://github.com/az-pz/hatch/blob/master/docs/assets/css/custom.css to hide $
from copying is certainly a possibility. But shell commands elsewhere in the docs don't use $
or console
code type.
$
was removed to make it consistent with other shell commands in the install.md .
Oh right you bring up a good point about console. @oprypin Can you recommend an approach that neglects syntax highlighting? I deliberately do not use that because the output gets highlighted randomly sometimes which I do not want users to see.
But shell commands elsewhere in the docs don't use $ or console code type.
https://github.com/search?q=repo%3Apypa%2Fhatch+%2F%5E+*%5C%24+%2F&type=code
I deliberately do not use that because the output gets highlighted randomly sometimes which I do not want users to see.
Hmm that's the first time I hear such a conclusion on the topic, wasn't aware
$ command foo 11 bar
Echo 123
More stuff
Why is this blue
It's conceivable that it is late at night after a long day and I don't know what I'm talking about, perhaps I was thinking about Bash since I do appear to use console elsewhere
Right- there can be arbitrary highlighting for the first word in the command, maybe that's what you were thinking of. But maybe we could configure and fix specific types of highlighting that you don't like, let me know
The text is blue because this the "output" highlighting
I am inclined to keep the dollar signs. Not only that, but when I think more about the situation, why would someone even press the copy button on a console snippet? Wouldn't it make more sense to disable copy there?
I'm not dismissing the other potential fix for copying to ignore that character I'm just curious what both of you think.
I definitely like dollar signs 😄 I think it can be confusing without them
perhaps I was thinking about Bash since I do appear to use console elsewhere
# console
$ command --that gets --syntax highlighting
no $ prefix here is for the output from command
so all of this content is intentionally the same colour
syntax highlighting for output would be awkward
# bash (technically the command shouldn't have the $ prefix
$ command --that gets --syntax highlighting
no $ prefix here is for the output from command
so all of this content is intentionally the same colour
syntax highlighting for output would be awkward
In mkdocs, depending on the config the syntax highlighting varies.
On github with the styling above, you can see the difference between the two for actual command highlighting is not all that useful... but it's better with actual bash scripts syntax, while console is more suitable for here is a command with the output.