HollowMan6 / mdbook-pdf

A backend for mdBook written in Rust for generating PDF based on headless chrome and Chrome DevTools Protocol. (用 Rust 编写的 mdBook 后端,基于headless chrome和Chrome开发工具协议生成PDF)
https://crates.io/crates/mdbook-pdf
GNU General Public License v3.0
153 stars 18 forks source link

Code in titles using gray background #26

Closed proski closed 1 year ago

proski commented 1 year ago

The PDF files produces by mdbook-pdf use gray background for code quotes in titles. It's a visual annoyance. The HTML is using white background in the light theme for everything, including titles and code in them, so I would expect the same in PDF. Worse yet, some PDF viewers make that text completely invisible, e.g. ReadEra on Android in the Twilight theme (which is my preferred way of reading Rust books).

I'm using be current mdbook (0.4.32) and mdbook-pdf (0.1.17). I'm running them on MacOS 13.4.1 with Chrome 115.

rustbook
HollowMan6 commented 1 year ago

Hi! This is related to the print style of mdbook's theme and is not controlled by our backend. You can raise an issue about this there so that this can be fixed. You can also try to change the print themes into some dark themes, such as coal, by setting flags in your book.toml, just like https://github.com/HollowMan6/mdbook-pdf/blob/main/test_doc/book.toml#L23-L24:

[output.pdf]
print-background = false
theme = "coal"

image

proski commented 1 year ago

I was able to get good results by doing following steps:

An alternative approach is to adjust background-color in the same file. #666666 is too dark when the foreground is black. #cccccc looked better, but I'd rather not see any custom backgrounds.

Changing print-background and theme under [output.pdf] didn't produce good results in any combination.

HollowMan6 commented 1 year ago

Yeah! Thanks for providing the detailed steps to fix this. Glad you find the issue to discuss with the upstream!

proski commented 1 year ago

The issue is fixed in mdbook 0.4.33.