-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
doc: provide epub download of The Book #20866
Comments
I've thought about this, as well. @steveklabnik, too. Technically, this might a bit tricky, partially because of #20826. What you need to do is create one markdown document with a correct outline (i.e. cleverly interpreting and changing headline levels) and in order of the table of contents (i.e. parsing the TOC file which is a markdown list containing links). But then it would be trivial to feed that to pandoc and generate all sorts of formats! |
As to #20826, I've just sent a pull request that might (or might not) close the issue. |
@akavel I don't think that'll solve this problem by itself, since all the chapter headings are actually level two in the global table of contents. E.g., "2.8. Compound Data Types" should be a level 2 heading in an ebook, therefore the content of that chapter should start headings at level 3. (In an epub/book, heading level 1 might be a "part", level 2 might be a "chapter" and level 3+ might be subsections.) Your changes might simplify the script needed to compile the book contents though. |
@akavel @steveklabnik I created an epub version of the book! |
Woohoo, awesome, thanks a lot! And the code samples seem to wordwrap quite nicely on my nook too, big thanks! :) |
@killercup would it be possible to integrate this back into our toolchain for us to officially provide it? |
@gankro please do! Consider the code to be in the public domain; just take it, it's yours. I don't think it'd take much time to rewrite this in Rust, it's just a bunch of calls to pandoc. It would be a nice feature for rustbook. |
Working on a general way to do this in https://github.com/azerupi/mdBook/issues/88. In the meantime, a rust book-specific version is probably as simple as:
|
It's not too difficult to make one of our doc builders produce the epub files and for us to publish it. The big wart here though is that we produce doc packages for every platform we publish, so every builder needs pandoc in order to keep them at parity. One thing we might do in the interim is to make epub artifacts opt-in, set up pandoc on our linux builder only (the one that we use to publish the docs to the website). Then we would be publishing the epubs, but e.g. the mac doc packages wouldn't contain it. Incidentally, splittiing non-api docs out of the repo would (with a lot of other work) fix this problem since we could build all the docs on linux. |
@killercup doesn't generate epubs anymore :-( So I made a script that generates proper Table Of Contents: #!/bin/sh
if [ ! -d "$1" ]; then
echo Usage: $(basename "$0") BOOKDIR \> trpl.md
echo Then: pandoc -S -o trpl.epub trpl.md
exit 1
fi
cat "$1/README.md"
echo
grep '^ *\*' "$1/SUMMARY.md" |
sed 's/^\*/main/g' |
sed 's/^ \+\*/sub/g' |
sed 's/\[.*\](\(.*\))/\1/g' |
while read level filename; do
cat "$1/$filename" |
if [ "$level" = "main" ]; then
sed 's/^\(#\+ \)/#\1/g' |
sed 's/^% /# /g'
else
sed 's/^\(#\+ \)/##\1/g' |
sed 's/^% /## /g'
fi |
sed 's/^\(```rust\),.*$/\1/g'
echo
done |
|
Help wanted: Write a .travis.yml to do this build on Travis and upload it to GitHub's releases storage. (ping me for help if this is confusing) |
Script from @okulev worked nicely for me, so +1 for that.
ebook-convert is from Calibre. I tried ebook-convert directly on the md instead of epub and it produced a PDF, but the resulting PDF is better if you use pandoc to convert it to epub first. pandoc may be able to convert directly to PDF without ebook-convert, but I got errors from pandoc about unrecognized unicode characters. ("Unicode char" ... "not set up for use with LaTeX".) That's probably fixable for someone that knows more about pandoc and LaTeX than I do. EDIT: I got pandoc PDF conversion working. No need for ebook-convert. |
Any download links to the recent book versions? |
@killercup 's repo works, but the files need to be updated. @killercup how would I do this? |
@jasonwilliams That would be great! Let us know if there's any progress! (Y) |
@DevQps |
Hello everyone, I have generated the
Hope it helps. |
Thanks for generating the offline ebooks! Your epub lacks the "ferrises" in the code boxes and some words are hyphenated in strange ways, but otherwise it looks great and is perfectly usable! I've so far enjoyed about the first quarter of it. The PDF on the other hand has a few major problems. Some code boxes are completely missing content (e.g. page 22, pages 74-80). In at least one place a big chunk of text is missing. Some of it has not compiled properly and is shown as a compressed super long line of TeX code (page 29). An epub rendering is what I wanted the most though, so thanks again for that! |
@antoneliasson Thank you for your detailed bug report! I'm very happy to hear about that the offline book is helpful. However, let me clarify some points:
In fact, I have read through the |
Help Needed! rust-lang/mdBook#1000 seems to be working pretty well from what i can see so far, I just need some feedback now. The PR allows the rust book to be read offline, new changes will still take affect. You can just navigate to https://jason-williams.co.uk/book/ and try it out, then leave any feedback in the issue above. |
I recently used mdbook-epub to build an epub version of several mdbooks, and this worked reasonably well. |
For pdf: I update the pdf every day via ci so it should be somewhat better :) Also, sorry I myself never use mobi so don't have any incentives to do it. |
Letting you know that .epub version of the Book would be nice to have here. |
Latest DIY steps for converting (any) Rust learning material to EPUB (or other ebook formats). Samples:
|
What are principal improvements in comparison with ~3 years old receipt? |
The following:
|
The file below, published at 2022-01-13, is convert via Epubor. Download if you need. |
This browser extension can convert HTML to EPUB easily. |
thx @CeresCa . |
@peterbartha's instructions (https://gist.github.com/peterbartha/54708ae739478a45b52612311d49717c) worked for me. Thanks! |
You can easily create the ebook yourself with papeer. It keeps content, text formatting, images and code blocks. Install it with: Use the CSS selector papeer get --selector='ol>li>a' --format=epub https://doc.rust-lang.org/book/
# [===========>] The Rust Programming Language - The Rust Programming Language (104 / 104)
# Ebook saved to "The_Rust_Programming_Language_-_The_Rust_Programming_Language.epub" The_Rust_Programming_Language_-_The_Rust_Programming_Language.epub.zip |
Here's a pdf print from the site - And I manually added table of contents there. |
Cool. How about .epub as on title on the top? |
How does one go about finding such a link for a future version? |
@impredicative if you are seeking pdf then you can find it here. Updated daily. https://github.com/shirshak55/Rust-Book-In-PDF/releases |
@shirshak55 Wow, super cool, It would be better if there were a epub version |
I don't plan on keeping this up to date sorry. Maybe it's possible to write a script that will link all the chapters in pdf but I didn't find a fast solution. So had to do it manually. |
This is a duplicate of rust-lang/book#3669 - in any case, book related issues should be filed over there. |
Closing this as the book issue already covers this |
Like shirshak55's daily PDF https://github.com/shirshak55/Rust-Book-In-PDF/releases, |
Could you possibly add an .epub version of The Book for download on the website?
The epub format seems at least mentioned in some Makefiles, so I hope this should be not very hard -- unless it's defunct and unsupported, and would have to be done from scratch? If not, then still there are some tools like pandoc, that I think support making epubs from Markdown already, so at least should be doable without reinventing the tools...
I'd be very grateful, thanks.
The text was updated successfully, but these errors were encountered: