-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look into publishing PDFs with mdbook-typst #1543
Comments
This exposed some bugs in my libraries, thanks! Attached is a generated PDF with the unreleased changes. Obviously there is more work to do, and I haven't yet styled on the typst side so presentation is lacking. The TOC and headings and stuff are a bit wonky as I tuned the heuristics on the mdBook guide. That area is pretty hacky and I am going to be beefing it up in the coming weeks so it works for most / all cases. There are escape hatches that let you directly insert typst markup before and after |
That looks awesome already! Much better than the normal pdf print output! That's great! |
Yeah, wow, thank you for producing this! People have asked for a PDF version once or twice — I suggest we publish this when we publish the course and replace the print page with a link directly to the PDF. |
Sorry to hijack this thread, but it seems to be gaining traction. I recently released a similar tool, [output.pandoc.profile.pdf]
output = "Comprehensive Rust.pdf"
pdf-engine = "lualatex" Two notes on generating the book
|
Awesome, that looks great! |
Thanks for posting this @max-heller! Seeing the course in this form makes me nostalgic for my old university days! I don't have a lot of bandwidth to experiment with this right now, but I would be supportive of us publishing a PDF along with the HTML. It's probably just a matter of adding a few lines to our |
Shouldn't it be able to be built into the Unfortunately that is less mobile compatible: https://caniuse.com/?search=pdf as fewer browsers seems to have a built-in pdf viewer. :/ The alternative could be to introduce another link on the top menu right-hand side for opening it as a pdf-book, or an |
Right, I think I agree: we can remove the 🖨️ button from the pages and instead link to the PDF.
If the I don't think much is lost if we don't link to
I would prefer to add a new page in the course which links to the PDF (and perhaps other formats if we generate those). Horizontal space is a costly resource, so this would allow us to remove the 🖨️ icon on every page. |
Yes, although it would be interesting to keep the print button and create a modal when clicking on it with an overview of all possible
I agree, that on mobile and in areas, where horizontal space is a costly resource, the printing symbol is definitely a nuisance: Though I would say, that it would be more intriguing to optimize the I personally would see that as better UI/UX because this is what people would expect (IMHO). And the printer icon is a bit of an essential way to interact with the user, when having a book, ebook whatever. I would even say in case of I think it's worth to keep and work with the value it has. |
That sounds somewhat complicated 🙂 — the course doesn't have a dedicated web developer associated with it, so it would likely be me who would maintain this.
Similarly, while this is a great goal, it is unfortunately outside the scope of what I can do on the course. In general, |
Renders the book as a PDF and includes it in the published HTML bundle as `comprehensive-rust.pdf`. Closes #1543
Thanks to the work of @max-heller, high-quality PDFs are now published on every merge to There are a few things to fix (emojis are not rendered), but I think the result looks very nice already. I suggest we try fixing the emojis and then start linking to the PDFs. |
Thanks @max-heller for implementing this, people are liking it a lot on Mastodon: https://elk.zone/ohai.social/@mgeisler/112054837248737025 🙂 |
This is really awesome! Would be cool actually, to have some easy to follow instructions how to do that for mdbooks in general. Would like to spread that knowledge a bit. |
The README for |
Would you be able to help us to get started over at rust-unofficial/patterns#380 to set that up for the Rust Patterns book? 😬 |
|
@max-heller Do you have any recommendation there which work well with unicode characters from your own experience? |
Depends a lot on which characters are needed in which contexts, unfortunately there's no mega font that includes every single glyph. For this book, we added Noto Color Emoji, Noto Sans Math, and Noto CJK fonts as necessary for non-English characters: Lines 37 to 42 in c633f85
|
There is a new tool which can convert an mdbook to Typst format, and thus also to high-quality PDFs: https://github.com/LegNeato/mdbook-typst
The text was updated successfully, but these errors were encountered: