-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(docs): align code block styles for shell snippets #15661
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
base: master
Are you sure you want to change the base?
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
```bash | ||
# Outputs all logs with levels debug and higher | ||
CARGO_LOG=debug cargo generate-lockfile | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to lean towards console
blocks for commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point as it feels shell-independent. Will fix those!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm, I thought so, but seems like bash
blocks works better (in terms of syntax highlighting) for multi-line commands with comments like this. How do you think about that...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tended to do $ #
. Not great but I feel its more semantically correct than describing these as bash scripts (which is what bash
means). Unsure if others have other opinions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds fair, however for especially one-liner like this, I'd prefer the ease of copy-pasting by removing leading $
:
cargo/src/doc/contrib/src/tests/writing.md
Lines 224 to 226 in f6cea42
```console | |
$ SNAPSHOTS=overwrite cargo test | |
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that as a tooling limitation and I personally still lean towards console
What does this PR try to resolve?
Current contributor document has inconsistent styles for shell-command snippets, like with or without leading
$
. This PR removes all leading$
and specify bash for syntax highlighting, for the ease of copy-pasting commands.