book
book copied to clipboard
Improve filename display to avoid interrupting text flow
- [x] I have checked the latest
mainbranch to see if this has already been fixed - [x] I have searched existing issues and pull requests for duplicates
URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html (and throughout the book)
Description of the problem:
The filename for each code listing is shown as a normal paragraph, breaking the flow from prose to code. This is especially jarring in early chapters, which also mention the filename in the preceding paragraph.

Suggested fix:
Move the filename to the right-hand side, and use color to visually attach it to the code listing:

I achieved this locally with a user stylesheet:
.filename { display: block; text-align: right; background: #eef; margin-bottom: -1em; }
But it would probably be better to change filename from <p> + <span> to <div> so it isn't necessary to force display: block or use fragile negative margins.