You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
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!
@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.
Just an update: Last week I redid most of that script I posted above. This now also deals with normalizing code blocks and fixing links. You can find it here and the results (html, epub, pdf) here.
You can easily create the ebook yourself with papeer. It keeps content, text formatting, images and code blocks.
Install it with: go install github.com/lapwat/papeer@latest
Use the CSS selector ol>li>a to select all table of content items. Specify epub format.
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"
How does one go about finding such a link for a future 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.
Activity
killercup commentedon Jan 10, 2015
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!
akavel commentedon Jan 10, 2015
As to #20826, I've just sent a pull request that might (or might not) close the issue.
killercup commentedon Jan 10, 2015
@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.
killercup commentedon Jan 11, 2015
@akavel @steveklabnik I created an epub version of the book!
akavel commentedon Jan 11, 2015
Woohoo, awesome, thanks a lot! And the code samples seem to wordwrap quite nicely on my nook too, big thanks! :)
Gankra commentedon Jan 21, 2015
@killercup would it be possible to integrate this back into our toolchain for us to officially provide it?
killercup commentedon Jan 21, 2015
@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.
killercup commentedon May 17, 2015
Just an update: Last week I redid most of that script I posted above. This now also deals with normalizing code blocks and fixing links. You can find it here and the results (html, epub, pdf) here.
steveklabnik commentedon Jan 4, 2016
Further update: I am still interested in getting this done, but takes some infrastructure work. @brson and @edunham and I should chat about it, maybe.
50 remaining items
zhoukuncheng commentedon Jun 25, 2022
This browser extension can convert HTML to EPUB easily.
https://github.com/dteviot/WebToEpub
anzbert commentedon Aug 7, 2022
thx @CeresCa .
I've used that extension to create create an epub for the latest book version
The_Rust_Programming_Language_1.59.epub.zip
miguno commentedon Jan 10, 2023
@peterbartha's instructions (https://gist.github.com/peterbartha/54708ae739478a45b52612311d49717c) worked for me. Thanks!
lapwat commentedon Jan 23, 2023
You can easily create the ebook yourself with papeer. It keeps content, text formatting, images and code blocks.
Install it with:
go install github.com/lapwat/papeer@latestUse the CSS selector
ol>li>ato select all table of content items. Specifyepubformat.The_Rust_Programming_Language_-_The_Rust_Programming_Language.epub.zip
ivanglushko commentedon May 25, 2023
Here's a pdf print from the site - And I manually added table of contents there.
The Rust Programming Language.pdf
vitali2y commentedon May 25, 2023
Cool. How about .epub as on title on the top?
impredicative commentedon May 29, 2023
How does one go about finding such a link for a future version?
shirshak55 commentedon Jun 1, 2023
@impredicative if you are seeking pdf then you can find it here. Updated daily. https://github.com/shirshak55/Rust-Book-In-PDF/releases
hustcer commentedon Jun 1, 2023
@shirshak55 Wow, super cool, It would be better if there were a epub version
ivanglushko commentedon Jun 1, 2023
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.
dralley commentedon Sep 4, 2023
This is a duplicate of rust-lang/book#3669 - in any case, book related issues should be filed over there.
Dylan-DPC commentedon Nov 18, 2023
Closing this as the book issue already covers this
dieterplex commentedon Feb 7, 2024
Like shirshak55's daily PDF https://github.com/shirshak55/Rust-Book-In-PDF/releases,
here's my daily ePub https://dieterplex.github.io/rust-ebookshelf/ in case someone is still interested.
Merge pull request rust-lang#20866 from ShoyuVanilla/metadata-err