Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove $ from command #1115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Remove $ from command #1115

wants to merge 1 commit into from

Conversation

az-pz
Copy link

@az-pz az-pz commented Dec 11, 2023

Remove $ from command to easily paste in terminal without getting an error. $ at the beginning gives an error.

Remove $ from command to easily paste  in terminal without getting an error. $ at the beginning gives an error.
@oprypin
Copy link
Contributor

oprypin commented Dec 12, 2023

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;
}

@ofek
Copy link
Sponsor Collaborator

ofek commented Dec 13, 2023

Oh interesting! Does that also affect the copy button?

@az-pz
Copy link
Author

az-pz commented Dec 13, 2023

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 .

@ofek
Copy link
Sponsor Collaborator

ofek commented Dec 13, 2023

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.

@oprypin
Copy link
Contributor

oprypin commented Dec 13, 2023

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

@ofek
Copy link
Sponsor Collaborator

ofek commented Dec 13, 2023

$ command foo 11 bar
Echo 123
More stuff
Why is this blue

@ofek
Copy link
Sponsor Collaborator

ofek commented Dec 13, 2023

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

@oprypin
Copy link
Contributor

oprypin commented Dec 13, 2023

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

@ofek
Copy link
Sponsor Collaborator

ofek commented Dec 13, 2023

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.

@oprypin
Copy link
Contributor

oprypin commented Dec 13, 2023

I definitely like dollar signs 😄 I think it can be confusing without them

@polarathene
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants