-
Notifications
You must be signed in to change notification settings - Fork 401
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
EPUB version of Rust cheat sheet #142
Comments
I haven't worked with ePUB before, but I'd accept PRs adding support similar to how the PDFs are generated. |
Ralf, two things:
|
I`ve made a first test, executing this two command lines:
I've watched it using Calibre, and some parts aren't shown properly, because I suppose they are drawn in HTML using "artificial tags" without content:
|
Interesting, ePUB might be stricter about tags. IIRC our tag use is out-of-spec, but still happens to work with all major browsers. I don't mind if a PR changes these a little bit (e.g., adding something inside
Oh that tag, fixed, thanks :)
Yes :) @johannst created a Github workflow in The site itself already has a few lines of CSS / JS logic to enter "print mode", which unfolds all tabs and hides irrelevant sections. On each Git push the Docker files will serve the site from a web server, with a sandboxed Chrome rendering it like a regular browser (incl. evaluating some JavaScript for syntax highlighting); and then PDF-printing it. Without knowing anything about ePUB, maybe it's easier to extract a version from the final DOM with the help of some JS? After all, to get proper syntax highlighting some JS will have to run anyway, as all of that is handled by Prism.js. |
@ralfbiedert, I don't know whether it is possible to extract a final DOM... I was thinking in the possibility of processing the input file (with added marks using HTML comments) to create images from those blocks of "non-native HTML tags and removing those blocks and putting HTML image tags that point to the generated images. Or, perhaps, it could be simpler preprocess the input file with regular expressions to create a temporal file that where it been changed |
The whole approach might need some exploration, but I think for a nice book the DOM has to come out of a browser (otherwise syntax highlighting won't work). I don't know if APIs exist to do that, but naively I'd try:
That logic would go into a |
@ralfbiedert, does this have the expected appearance? Or should it be in bigger and bold font? Or a missing caption? |
This is technically correct, that header is only
I'm no font expert, but there might be size / weight mismatches because some fonts, in their design, interpret sizes / weights differently, and it would be hard to control for these (given the browser might fallback to a different font). |
I think it would be useful to create a ePUB version of the Rust cheat sheet? That would be more readable in small screens, as in a smartphone, or tablets.
The text was updated successfully, but these errors were encountered: