Comments (17)
Do you want to deactivate the CDN completely everywhere?
from mdbook.
It would be good to add an option to disable remote loading completely. We have all of this stuff in Debian and would ideally just point to the local files. At the moment we have to carry patches in rustc instead.
from mdbook.
I ran into an issue with a poor WiFi connection on the train the other day. The Rust Book was slow to load pages in what I thought was offline mode using rustup doc --book
. The cause was the need to load the Google fonts which I did not have cached. When they were downloaded things improved, but the experience before that was frustrating.
I don't know what the size of the font files is and I suspect they're too large to embed in a binary, but I think there's a way to write it so a default browser font is loaded first and the Google font gets used if it's eventually downloaded.
from mdbook.
MathJax seems like a lot of files, currently not easily embeddable into the binary (as far as I know)..
JQuery and Font Awesome where the most important ones. I will therefore remove this issue from 0.0.2 milestone. Leave it like this until a better solution is found.
from mdbook.
FYI: MathJax CDN is shutting down. Might want to switch to CDNJS in the meantime.
from mdbook.
One primary benefit of loading this stuff locally, is that my ISP really doesn't need to know when I'm reading rust documentation. :/
from mdbook.
@infinity0 You mean when you are reading the docs locally?
Indeed the CDN thing is only an improvement when loading from a remote source. I am not sure how I could differentiate the two use cases though?
from mdbook.
Perhaps it could read a mdbook.toml
file that lets you define alternate local URLs for these resources? Or, get them from an environment variable.
from mdbook.
Yeah, that would be nice. We have them available locally in various subdirectories of /usr/share/fonts
and /usr/share/javascript
, though I can't speak for other distros.
from mdbook.
I have made a new issue #271. Feel free to comment there :)
from mdbook.
Great, thanks!
from mdbook.
Thanks for working on this issue!
Is there a setting that allows me to deactivate CDN usage? Can I host all dependencies in the build
folder?
from mdbook.
I had a very similar problem as @reillysiemens. I was in a situation where I didn't have any internet connectivity. I noticed the page was (roughly) blocked on resolving fonts.googleapis.com, so I added a link-local entry in my /etc/hosts for that domain (so the resolution completed, at least - then the fetch failed quickly). Would treating the fonts.googleapis.com resources in a similar way as the google_analytics be acceptable? With this, I mean can the font.googleapis.com resources be conditionally included using a similar conditional? I'm guessing the page is nicer/prettier when using the Google fonts, but they don't seem to be a requirement.
from mdbook.
Just adding my vote for offline support. Hit this yesterday while on the train. I really like how the Rust docs are readable locally and often read them that way, but I hadn't tested this in a truly offline situation until now.
from mdbook.
Would it be possible to add an option when generating that simply disables those external stylesheets so default fonts are used?
from mdbook.
@oyvindln Fallback of font family is a standard strategy with CSS. So that seems unneeded.
from mdbook.
Local fallback for MathJax added in #1918. Review, please.
from mdbook.
Related Issues (20)
- Images with relative path not displayed on index.html HOT 1
- Figure out a strategy for updating public dependencies HOT 1
- 0.4.38 release has no assets HOT 2
- Is there a way to use own markdown short code templates? HOT 2
- Non-English search support HOT 5
- Replace icon fonts with SVG HOT 1
- Use capital letters to indicate the default value in (y/n) prompts
- serve only html backend
- Support for automated tests in languages other than Rust
- Exclude page from printing
- If `!search_config.copy_js`, then perform useless search indexing, and search is disabled
- feat(ux): add CMD+K support HOT 3
- Cannot load custom font files with 'mdbook serve' on macOS
- warn on orphan files
- Ordering of footnote HOT 1
- Ensure Consistent Table Widths in mdBook
- Keep summary links untouched (including Markdown formatting) instead of extracting just plain text
- Is there an option to disable automatic file creation from `SUMMARY.md`? HOT 2
- Small options for creating interactive fictions HOT 2
- Use Content-Secure-Policy compatible scripts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdbook.