Skip to content

Commit

Permalink
infra: Convert one listing to use <Listing>
Browse files Browse the repository at this point in the history
- Add CSS for `figure.listing`; this now renders identically to how the
  existing listings render.
- Convert the first listing in the book to use `<Listing>` instead of
  a bunch of `<span>`s.
  • Loading branch information
chriskrycho committed May 14, 2024
1 parent e65efe3 commit 17c244a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title = "The Rust Programming Language"
authors = ["Steve Klabnik", "Carol Nichols", "Contributions from the Rust Community"]

[output.html]
additional-css = ["ferris.css", "theme/2018-edition.css", "theme/semantic-notes.css"]
additional-css = ["ferris.css", "theme/2018-edition.css", "theme/semantic-notes.css", "theme/listing.css"]
additional-js = ["ferris.js"]
git-repository-url = "https://github.com/rust-lang/book"

Expand Down
4 changes: 2 additions & 2 deletions src/ch01-02-hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ convention is to use an underscore to separate them. For example, use

Now open the *main.rs* file you just created and enter the code in Listing 1-1.

<span class="filename">Filename: main.rs</span>
<Listing number="1-1" file-name="main.rs" caption="A program that prints `Hello, world!`">

```rust
fn main() {
println!("Hello, world!");
}
```

<span class="caption">Listing 1-1: A program that prints `Hello, world!`</span>
</Listing>

Save the file and go back to your terminal window in the
*~/projects/hello_world* directory. On Linux or macOS, enter the following
Expand Down
3 changes: 3 additions & 0 deletions theme/listing.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
figure.listing {
margin: 0;
}

0 comments on commit 17c244a

Please sign in to comment.