Skip to content

Commit 55b72dd

Browse files
committed
Auto merge of #4923 - wking:console-markup, r=alexcrichton
doc: Replace 'shell' language labels (generally with 'console') #GitHub [uses Linguist][1] for syntax highlighting. Linguist's [`shell` language][2] is for the *language* (e.g. the contents of a `.sh` file). The proper language for a shell session is [`ShellSession`][3], although in this commit I've used the [alias `console`][4]. The Cargo book [uses mdBook][4.5], mdBook [uses Highlight.js][5], and Highlight.js [also supports `console` as an alias for shell sessions][6]. A handful of places where we had been using `shell` were just command output, not shell sessions (e.g. they lacked a prompt and command). In this commit, I've left those without a language label. [1]: https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting [2]: https://github.com/github/linguist/blob/v5.3.3/lib/linguist/languages.yml#L4208 [3]: https://github.com/github/linguist/blob/v5.3.3/lib/linguist/languages.yml#L4249 [4]: https://github.com/github/linguist/blob/v5.3.3/lib/linguist/languages.yml#L4255 [4.5]: https://github.com/rust-lang/cargo/tree/f60ece98c10aa3716d037524da4ee989e212fe19/src/doc#requirements [5]: https://rust-lang-nursery.github.io/mdBook/format/theme/syntax-highlighting.html#syntax-highlighting [6]: https://github.com/isagalaev/highlight.js/blob/9.12.0/src/languages/shell.js#L10
2 parents 1fc8797 + bc489e2 commit 55b72dd

File tree

13 files changed

+37
-37
lines changed

13 files changed

+37
-37
lines changed

src/doc/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,31 @@ Building the book requires [mdBook]. To get it:
77

88
[mdBook]: https://github.com/azerupi/mdBook
99

10-
```shell
10+
```console
1111
$ cargo install mdbook
1212
```
1313

1414
### Building
1515

1616
To build the book:
1717

18-
```shell
18+
```console
1919
$ mdbook build
2020
```
2121

2222
The output will be in the `book` subdirectory. To check it out, open it in
2323
your web browser.
2424

2525
_Firefox:_
26-
```shell
26+
```console
2727
$ firefox book/index.html # Linux
2828
$ open -a "Firefox" book/index.html # OS X
2929
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
3030
$ start firefox.exe .\book\index.html # Windows (Cmd)
3131
```
3232

3333
_Chrome:_
34-
```shell
34+
```console
3535
$ google-chrome book/index.html # Linux
3636
$ open -a "Google Chrome" book/index.html # OS X
3737
$ Start-Process "chrome.exe" .\book\index.html # Windows (PowerShell)

src/doc/src/getting-started/first-steps.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
To start a new project with Cargo, use `cargo new`:
44

5-
```shell
5+
```console
66
$ cargo new hello_world --bin
77
```
88

@@ -11,7 +11,7 @@ were making a library, we’d leave it off.
1111

1212
Let’s check out what Cargo has generated for us:
1313

14-
```shell
14+
```console
1515
$ cd hello_world
1616
$ tree .
1717
.
@@ -44,21 +44,21 @@ fn main() {
4444

4545
Cargo generated a “hello world” for us. Let’s compile it:
4646

47-
```shell
47+
```console
4848
$ cargo build
4949
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
5050
```
5151

5252
And then run it:
5353

54-
```shell
54+
```console
5555
$ ./target/debug/hello_world
5656
Hello, world!
5757
```
5858

5959
We can also use `cargo run` to compile and then run it, all in one step:
6060

61-
```shell
61+
```console
6262
$ cargo run
6363
Fresh hello_world v0.1.0 (file:///path/to/project/hello_world)
6464
Running `target/hello_world`

src/doc/src/getting-started/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
The easiest way to get Cargo is to get the current stable release of [Rust] by
66
using the `rustup` script:
77

8-
```shell
8+
```console
99
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
1010
```
1111

src/doc/src/guide/cargo-toml-vs-cargo-lock.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ they’ll use the exact same SHA, even though we didn’t specify it in our
9292
When we’re ready to opt in to a new version of the library, Cargo can
9393
re-calculate the dependencies and update things for us:
9494

95-
```shell
95+
```console
9696
$ cargo update # updates all dependencies
9797
$ cargo update -p rand # updates just “rand”
9898
```

src/doc/src/guide/creating-a-new-project.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
To start a new project with Cargo, use `cargo new`:
44

5-
```shell
5+
```console
66
$ cargo new hello_world --bin
77
```
88

@@ -12,7 +12,7 @@ repository by default. If you don't want it to do that, pass `--vcs none`.
1212

1313
Let’s check out what Cargo has generated for us:
1414

15-
```shell
15+
```console
1616
$ cd hello_world
1717
$ tree .
1818
.
@@ -47,14 +47,14 @@ fn main() {
4747

4848
Cargo generated a “hello world” for us. Let’s compile it:
4949

50-
```shell
50+
```console
5151
$ cargo build
5252
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
5353
```
5454

5555
And then run it:
5656

57-
```shell
57+
```console
5858
$ ./target/debug/hello_world
5959
Hello, world!
6060
```
@@ -63,7 +63,7 @@ We can also use `cargo run` to compile and then run it, all in one step (You
6363
won't see the `Compiling` line if you have not made any changes since you last
6464
compiled):
6565

66-
```shell
66+
```console
6767
$ cargo run
6868
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
6969
Running `target/debug/hello_world`
@@ -76,7 +76,7 @@ dependencies. Since we don’t have any yet, it’s not very interesting.
7676
Once you’re ready for release, you can use `cargo build --release` to compile
7777
your files with optimizations turned on:
7878

79-
```shell
79+
```console
8080
$ cargo build --release
8181
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
8282
```

src/doc/src/guide/dependencies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ regex = "0.1.41"
4444
Re-run `cargo build`, and Cargo will fetch the new dependencies and all of
4545
their dependencies, compile them all, and update the `Cargo.lock`:
4646

47-
```shell
47+
```console
4848
$ cargo build
4949
Updating registry `https://github.com/rust-lang/crates.io-index`
5050
Downloading memchr v0.1.5
@@ -83,7 +83,7 @@ fn main() {
8383

8484
Running it will show:
8585

86-
```shell
86+
```console
8787
$ cargo run
8888
Running `target/hello_world`
8989
Did our date match? true

src/doc/src/guide/project-layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Cargo uses conventions for file placement to make it easy to dive into a new
44
Cargo project:
55

6-
```shell
6+
```
77
.
88
├── Cargo.lock
99
├── Cargo.toml

src/doc/src/guide/tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ the files in `tests`.
99
Here's an example of running `cargo test` in our project, which currently has
1010
no tests:
1111

12-
```shell
12+
```console
1313
$ cargo test
1414
Compiling rand v0.1.0 (https://github.com/rust-lang-nursery/rand.git#9f35b8e)
1515
Compiling hello_world v0.1.0 (file:///path/to/project/hello_world)
@@ -25,7 +25,7 @@ tests.
2525

2626
You can also run a specific test by passing a filter:
2727

28-
```shell
28+
```console
2929
$ cargo test foo
3030
```
3131

src/doc/src/guide/working-on-an-existing-project.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ to get going.
66
First, get the project from somewhere. In this example, we’ll use `rand`
77
cloned from its repository on GitHub:
88

9-
```shell
9+
```console
1010
$ git clone https://github.com/rust-lang-nursery/rand.git
1111
$ cd rand
1212
```
1313

1414
To build, use `cargo build`:
1515

16-
```shell
16+
```console
1717
$ cargo build
1818
Compiling rand v0.1.0 (file:///path/to/project/rand)
1919
```

src/doc/src/reference/build-scripts.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if you want to ensure that output is always displayed on your terminal.
5656
Any line that starts with `cargo:` is interpreted directly by Cargo.
5757
This line must be of the form `cargo:key=value`, like the examples below:
5858

59-
```shell
59+
```
6060
# specially recognized by Cargo
6161
cargo:rustc-link-lib=static=foo
6262
cargo:rustc-link-search=native=/path/to/foo
@@ -219,7 +219,7 @@ library call as part of the build script.
219219

220220
First, let’s take a look at the directory structure of this package:
221221

222-
```shell
222+
```
223223
.
224224
├── Cargo.toml
225225
├── build.rs
@@ -305,7 +305,7 @@ a Rust library which calls into C to print “Hello, World!”.
305305

306306
Like above, let’s first take a look at the project layout:
307307

308-
```shell
308+
```
309309
.
310310
├── Cargo.toml
311311
├── build.rs

0 commit comments

Comments
 (0)