Skip to content

Commit 3c38b59

Browse files
committed
Replace all uses of bash syntax highlighting
Since none of these are actually bash scripts :) Changed all the instances in the src files to text, which, since my PR to mdbook got accepted, will still do code background colors but no syntax highlighting. Fixes #295 and #327.
1 parent dbe2c1a commit 3c38b59

25 files changed

+96
-96
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,36 @@ Building the book requires [mdBook] >= v0.0.13. To get it:
1919

2020
[mdBook]: https://github.com/azerupi/mdBook
2121

22-
```bash
22+
```
2323
$ cargo install mdbook
2424
```
2525

2626
## Building
2727

2828
To build the book, type:
2929

30-
```bash
30+
```
3131
$ mdbook build
3232
```
3333

3434
The output will be in the `book` subdirectory. To check it out, open it in
3535
your web browser.
3636

3737
_Firefox:_
38-
```bash
38+
```
3939
$ firefox book/index.html # Linux
4040
$ open -a "Firefox" book/index.html # OS X
4141
```
4242

4343
_Chrome:_
44-
```bash
44+
```
4545
$ google-chrome book/index.html # Linux
4646
$ open -a "Google Chrome" book/index.html # OS X
4747
```
4848

4949
To run the tests:
5050

51-
```bash
51+
```
5252
$ mdbook test
5353
```
5454

src/appendix-02-operators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ Any such expression always has the `unit` type.
174174
The precedence of Rust binary operators is ordered as follows, going from
175175
strong to weak:
176176

177-
```bash
177+
```text
178178
as :
179179
* / %
180180
+ -

src/ch01-01-installation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ with `$` are typically showing the output of the previous command.
1616
If you're on Linux or a Mac, all you need to do is open a terminal and type
1717
this:
1818

19-
```bash
19+
```text
2020
$ curl https://sh.rustup.rs -sSf | sh
2121
```
2222

2323
This will download a script and start the installation. You may be prompted for
2424
your password. If it all goes well, you’ll see this appear:
2525

26-
```bash
26+
```text
2727
Rust is installed now. Great!
2828
```
2929

@@ -48,22 +48,22 @@ installation page](https://www.rust-lang.org/install.html) for other options.
4848
Uninstalling Rust is as easy as installing it. From your shell, run
4949
the uninstall script:
5050

51-
```bash
51+
```text
5252
$ rustup self uninstall
5353
```
5454

5555
### Troubleshooting
5656

5757
If you've got Rust installed, you can open up a shell, and type this:
5858

59-
```bash
59+
```text
6060
$ rustc --version
6161
```
6262

6363
You should see the version number, commit hash, and commit date in a format
6464
similar to this for the latest stable version at the time you install:
6565

66-
```bash
66+
```text
6767
rustc x.y.z (abcabcabc yyyy-mm-dd)
6868
```
6969

src/ch01-02-hello-world.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ the following commands to make a directory for this particular project:
1919

2020
Linux and Mac:
2121

22-
```bash
22+
```text
2323
$ mkdir ~/projects
2424
$ cd ~/projects
2525
$ mkdir hello_world
@@ -55,7 +55,7 @@ fn main() {
5555
Save the file, and go back to your terminal window. On Linux or OSX, enter the
5656
following commands:
5757

58-
```bash
58+
```text
5959
$ rustc main.rs
6060
$ ./main
6161
Hello, world!
@@ -121,7 +121,7 @@ Before running a Rust program, you have to compile it. You can use the Rust
121121
compiler by entering the `rustc` command and passing it the name of your source
122122
file, like this:
123123

124-
```bash
124+
```text
125125
$ rustc main.rs
126126
```
127127

@@ -130,7 +130,7 @@ If you come from a C or C++ background, you'll notice that this is similar to
130130
executable, which you can see on Linux or OSX by entering the `ls` command in
131131
your shell as follows:
132132

133-
```bash
133+
```text
134134
$ ls
135135
main main.rs
136136
```
@@ -147,7 +147,7 @@ This shows we have two files: the source code, with the `.rs` extension, and the
147147
executable (`main.exe` on Windows, `main` everywhere else). All that's left to
148148
do from here is run the `main` or `main.exe` file, like this:
149149

150-
```bash
150+
```text
151151
$ ./main # or .\main.exe on Windows
152152
```
153153

@@ -189,7 +189,7 @@ itself, if you used the official installers as covered in the Installation
189189
chapter. If you installed Rust through some other means, you can check if you
190190
have Cargo installed by typing the following into your terminal:
191191

192-
```bash
192+
```text
193193
$ cargo --version
194194
```
195195

@@ -205,7 +205,7 @@ decided to put your code):
205205

206206
Linux and Mac:
207207

208-
```bash
208+
```text
209209
$ cd ~/projects
210210
```
211211

@@ -217,7 +217,7 @@ Windows:
217217

218218
And then on any operating system run:
219219

220-
```bash
220+
```text
221221
$ cargo new hello_cargo --bin
222222
$ cd hello_cargo
223223
```
@@ -304,15 +304,15 @@ Cargo by moving your code into the `src` directory and creating an appropriate
304304
Now let's look at what's different about building and running your Hello World
305305
program through Cargo! To do so, enter the following commands:
306306

307-
```bash
307+
```text
308308
$ cargo build
309309
Compiling hello_cargo v0.1.0 (file:///projects/hello_cargo)
310310
```
311311

312312
This should have created an executable file in `target/debug/hello_cargo` (or
313313
`target\debug\hello_cargo.exe` on Windows), which you can run with this command:
314314

315-
```bash
315+
```text
316316
$ ./target/debug/hello_cargo # or .\target\debug\hello_cargo.exe on Windows
317317
Hello, world!
318318
```
@@ -339,7 +339,7 @@ We just built a project with `cargo build` and ran it with
339339
`./target/debug/hello_cargo`, but we can also use `cargo run` to compile
340340
and then run:
341341

342-
```bash
342+
```text
343343
$ cargo run
344344
Running `target/debug/hello_cargo`
345345
Hello, world!
@@ -351,7 +351,7 @@ it just ran the binary. If you had modified your source code, Cargo would have
351351
rebuilt the project before running it, and you would have seen something like
352352
this:
353353

354-
```bash
354+
```text
355355
$ cargo run
356356
Compiling hello_cargo v0.1.0 (file:///projects/hello_cargo)
357357
Running `target/debug/hello_cargo`
@@ -393,7 +393,7 @@ tooling you’ll use for the rest of your Rust career. In fact, you can get
393393
started with virtually all Rust projects you want to work
394394
on with the following commands:
395395

396-
```bash
396+
```text
397397
$ git clone someurl.com/someproject
398398
$ cd someproject
399399
$ cargo build

src/ch02-00-guessing-game-tutorial.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ game will print congratulations and exit.
1717
To set up a new project, go to the *projects* directory that you created in
1818
Chapter 1, and make a new project using Cargo, like so:
1919

20-
```bash
20+
```text
2121
$ cargo new guessing_game --bin
2222
$ cd guessing_game
2323
```
@@ -57,7 +57,7 @@ fn main() {
5757
Now let’s compile this “Hello, world!” program and run it in the same step
5858
using the `cargo run` command:
5959

60-
```bash
60+
```text
6161
$ cargo run
6262
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
6363
Running `target/debug/guessing_game`
@@ -281,7 +281,7 @@ entered into standard input.
281281

282282
If we don’t call `expect`, the program will compile, but we’ll get a warning:
283283

284-
```bash
284+
```text
285285
$ cargo build
286286
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
287287
src/main.rs:10:5: 10:39 warning: unused result which must be used,
@@ -324,7 +324,7 @@ This code would print out `x = 5 and y = 10`.
324324

325325
Let’s test the first part of the guessing game. You can run it using `cargo run`:
326326

327-
```bash
327+
```text
328328
$ cargo run
329329
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
330330
Running `target/debug/guessing_game`
@@ -382,7 +382,7 @@ version 0.3.14.”
382382
Now, without changing any of the code, let’s build the project, as shown in
383383
Listing 2-2:
384384

385-
```bash
385+
```text
386386
$ cargo build
387387
Updating registry `https://github.com/rust-lang/crates.io-index`
388388
Downloading rand v0.3.14
@@ -421,7 +421,7 @@ doesn't recompile that either. With nothing to do, it simply exits. If you open
421421
up the *src/main.rs* file, make a trivial change, then save it and build again,
422422
you’ll only see one line of output:
423423

424-
```bash
424+
```text
425425
$ cargo build
426426
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
427427
```
@@ -464,7 +464,7 @@ But by default, Cargo will only look for versions larger than `0.3.0` and
464464
smaller than `0.4.0`. If the `rand` crate has released two new versions,
465465
`0.3.15` and `0.4.0`, you would see the following if you ran `cargo update`:
466466

467-
```bash
467+
```text
468468
$ cargo update
469469
Updating registry `https://github.com/rust-lang/crates.io-index`
470470
Updating rand v0.3.14 -> v0.3.15
@@ -564,7 +564,7 @@ the answer as soon as it starts!
564564

565565
Try running the program a few times:
566566

567-
```bash
567+
```text
568568
$ cargo run
569569
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
570570
Running `target/debug/guessing_game`
@@ -675,7 +675,7 @@ look at the last arm in this particular scenario.
675675

676676
However, the code in Listing 2-4 won’t compile yet. Let’s try it:
677677

678-
```bash
678+
```text
679679
$ cargo build
680680
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
681681
error[E0308]: mismatched types
@@ -793,7 +793,7 @@ and `expect` will return the number that we want from the `Ok` value.
793793

794794
Let’s run the program now!
795795

796-
```bash
796+
```text
797797
$ cargo run
798798
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
799799
Running `target/guessing_game`
@@ -868,7 +868,7 @@ the `parse` discussion in “Comparing the Guesses” on page XX: if the user
868868
enters a non-number answer, the program will crash. The user can take advantage
869869
of that in order to quit, as shown here:
870870

871-
```bash
871+
```text
872872
$ cargo run
873873
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
874874
Running `target/guessing_game`
@@ -985,7 +985,7 @@ might encounter!
985985
Now everything in the program should work as expected. Let’s try it by running
986986
`cargo run`:
987987

988-
```bash
988+
```text
989989
$ cargo run
990990
Compiling guessing_game v0.1.0 (file:///projects/guessing_game)
991991
Running `target/guessing_game`

src/ch03-01-variables-and-mutability.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main() {
2727
Save and run the program using `cargo run`. You should receive an error
2828
message, as shown in this output:
2929

30-
```bash
30+
```text
3131
$ cargo run
3232
Compiling variables v0.0.1 (file:///projects/variables)
3333
error[E0384]: re-assignment of immutable variable `x`
@@ -82,7 +82,7 @@ fn main() {
8282

8383
When we run this program, we get the following:
8484

85-
```bash
85+
```text
8686
$ cargo run
8787
Compiling variables v0.1.0 (file:///projects/variables)
8888
Running `target/debug/variables`
@@ -166,7 +166,7 @@ repeating `let x =`, taking the original value and adding `1` so the value of
166166
previous value and multiplying it by `2` to give `x` a final value of `12`.
167167
When you run this program, it will output the following:
168168

169-
```bash
169+
```text
170170
$ cargo run
171171
Compiling variables v0.1.0 (file:///projects/variables)
172172
Running `target/debug/variables`
@@ -204,7 +204,7 @@ spaces = spaces.len();
204204
we’ll get a compile-time error because we’re not allowed to mutate a variable’s
205205
type:
206206

207-
```bash
207+
```text
208208
error[E0308]: mismatched types
209209
--> src/main.rs:3:14
210210
|

src/ch03-02-data-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If we don’t add the type annotation here, Rust will display the following
2020
error, which means the compiler needs more information from us to know which
2121
possible type we want to use:
2222

23-
```bash
23+
```text
2424
error[E0282]: unable to infer enough type information about `_`
2525
--> src/main.rs:2:5
2626
|
@@ -347,7 +347,7 @@ fn main() {
347347

348348
Running this code using `cargo run` produces the following result:
349349

350-
```bash
350+
```text
351351
$ cargo run
352352
Compiling arrays v0.1.0 (file:///projects/arrays)
353353
Running `target/debug/arrays`

0 commit comments

Comments
 (0)