book icon indicating copy to clipboard operation
book copied to clipboard

Improve filename display to avoid interrupting text flow

Open jruderman opened this issue 4 years ago • 2 comments

  • [x] I have checked the latest main branch 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.

image

Suggested fix:

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

image

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.

jruderman avatar Sep 09 '21 11:09 jruderman