rust-lang / book

The Rust Programming Language
https://doc.rust-lang.org/book/
Other
14.93k stars 3.37k forks source link

HTML print output does not include chapter numbers #4027

Open dilyanpalauzov opened 1 week ago

dilyanpalauzov commented 1 week ago

When I click on https://doc.rust-lang.org/book/ → Printer icon 🖶 in the right upper corner, this page loads https://doc.rust-lang.org/book/print.html. I print the output. All the hyperlinks are now gone.

The printout speaks on several places about chapters using numbers, e. g. on page 587 “Valid pattern syntax in macro definitions is different than the pattern syntax covered in Chapter 18 because macro patterns are matched against Rust code structure rather than values.”

The problem report is, that when the file is printed, there is no “Chapter 18”: the chapters are labelled only by names, not by numbers.

chriskrycho commented 6 days ago

Thanks for the feedback. This is mostly a limitation of mdBook, rather than an issue with this text directly. I updated the title so it’s clearer for us what the issue is going forward, particularly because we normally mean the NoStarch physical copy when we refer to “the print(ed) book”. If we include the chapter numbers directly, we would end up with rendered output looking like this:

Outline rendering

That is obviously quite undesirable. That said, I also agree that it would be better if we did have those numbers present when you print out the HTML version the way you did! I’ll check for an upstream issue, and create it if it does not exist, and link it back here either way.

As regards links being stripped out: well, yeah, it’s just printing HTML! The links are actually still “present”, but they do not do you much good. However, we could look into updating the print stylesheet to include those as text; I will create a new issue tracking that.