mdBook
mdBook copied to clipboard
Exporting to PDF and ePub
Does mdBook
support exporting to PDF and ePub? If not, then this is a feature request/suggestion, otherwise documentation request/suggestion.
I found https://github.com/lise-henry/crowbook. It might be worth it to take a look and integrate it (I'm not Rust developer). Also, that was my first google search result, there might be better tools/libraries.
A while back I created an alternate backend for generating EPUB documents and published it on crates.io. It's pretty rough around the corners and doesn't do any styling, but I'd be happy to help mentor people if they want to take over development.
mdbook
has a pretty good plugin architecture (docs), so it's also quite possible to write your own backend if you want.
Would be nice to have! I heard some people migrating from mdBook to another solutions, some proprietary exactly because of the missing export to PDF.
I'm not too involved in mdbook
development these days, but if someone wants to help work on mdbook-epub
I'd be happy to add them as a collaborator.
There is also mdproof for generating PDFs from Markdown files. Maybe it can be integrated with mdBook?
I'm currently working on mdbook-latex
, a backend for mdbook that aims to support LaTeX and PDF exports. It's primarily built upon pulldown-cmark, Tectonic, md2pdf, and a lot of other great programs.
Here is The Rust Programming Language PDF and LaTeX files generated by mdbook-latex
:
The Rust Programming Language.pdf The Rust Programming Language.tex
On my Thinkpad x220, it took 4.757 seconds
to generate the LaTeX, and 1 minute 8.62 seconds
to generate the PDF (so it won't break any speed records). And there are typesetting errors aplenty that I plan to fix in future releases.
I'm very new to Rust (and programming in general), so there are a lot of things that can be improved upon (and a better alternative PDF exporter is almost certainly possible!). Pull requests, forks, and plain old copy-pasting are actively encouraged!
There is also a roadmap to the stable release for mdbook-latex
.
For anyone else looking to making a PDF or LaTeX mdbook backend, mdbook-epub and crowbook are two programs that are super helpful for learning how to parse markdown or write a proper backend. The mdbook User Guide has a terrific section regarding that as well!
+100500 for Tectonic. They seem to improve based on arXiv dataset testing, along with better integration with texlab.
That's awesome! I'll check out mdproof as well, It would be great to have the option to skip any LaTeX dependencies if you wanted a quick and simple PDF.
Note, there is ongoing effort to Oxidize the Tectonic, and ditch legacy C code out of its engine. After this is done, probably better integration will be possible.
That's a feature I'd definitely love to see. Currently I'm using R's Bookdown and blogdown to author books and blogs. I wish there will be similar implementations of these packages in Rust.
I'm current learning Rust, and I hope I can contribute to this feature (probably in the summer when I have a good understanding of Rust).
This is a duplicate of #88 (Support ebooks and pdf export)
That's a feature I'd definitely love to see. Currently I'm using R's Bookdown and blogdown to author books and blogs. I wish there will be similar implementations of these packages in Rust.
I'm current learning Rust, and I hope I can contribute to this feature (probably in the summer when I have a good understanding of Rust).
How is progress? I'm waiting for it.
@lbeckman314 I would want to donate for your efforts, and I think many others as well. Could you please setup a an account for that? GitHub Sponsors, OpenCollective, etc
Since there is zero interest to support that in mdBook, I recommend a relatively new framework to create books, more flexible that commonly known Bookdown - Quarto. It's pandoc-based, thus can export to basically anything. You can see their gallery for samples how such different formats and exports look like. It's quite actively developed as well.
Hi all! I just created a mdBook backend named mdbook-pdf for generating PDF based on headless chrome and Chrome DevTools Protocol Page.printToPDF. It depends on Google Chrome / Microsoft Edge / Chromium. The generated page are pretty much alike the one you manually printed to PDF in your browser by opening print.html
or mentioned here: https://github.com/rust-lang/mdBook/issues/88#issuecomment-541337635 , but with customization of PDF paper orientation, scale of the webpage rendering, paper width and height, page margins, generated PDF page ranges, whether to display header and footer as well as customize their formats, and more, as well as automation. It supports all the platform where Google Chrome / Microsoft Edge / Chromium would work. You can check samples of the generated PDF files in the Artifacts here.
PDF format with Table of Contents is needed.
PDF format with Table of Contents is needed.
mdbook-pdf now supports Table of Content, see: https://github.com/HollowMan6/mdbook-pdf/issues/1#issuecomment-1366157949
I just released mdbook-typst
. While it isn't 100% done, it supports PDF output with links, bookmarks, and pdf metadata.
Attached is the converted guide and a screenshot.
If you want more control, you may be interested in the other 2 projects I just released:
- https://github.com/LegNeato/pullup/tree/main/pulldown_mdbook
- https://github.com/LegNeato/pullup (which uses the previous)
I built mdbook-pandoc
, a backend powered by Pandoc. Pandoc is quite mature and supports many output formats, including PDF (I've mainly tested LaTeX) and EPUB. Sample rendered PDF books are here.