Book: Can not view book offline

Created on 20 May 2017  路  4Comments  路  Source: rust-lang/book

After downloading the source and compiling with mdbook I went into the book directory, opened up a Chromium window and... Blank page. Tried Firefox, and again, the same thing happened. I attempted to figure out the problem, and I found it! It is the following lines in all of the *.html pages:

        <link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>


        <!-- Font Awesome -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

        <!-- MathJax -->
        <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

        <!-- Fetch JQuery from CDN but have a local fallback -->
        <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
        <script>
            if (typeof jQuery == 'undefined') {
                document.write(unescape("%3Cscript src='jquery.js'%3E%3C/script%3E"));
            }
        </script>

You see, by including these lines in the HTML, you prevent anyone who doesn't have an active internet connection from reading the book. Not only can I not get to https://doc.rust-lang.org/book/ but the copy I downloaded and built locally won't load unless it gets these files.

But, my fine sir, you may say, does not every soul have access to this wonderful tool known as the internet?

NO! I have waited days to try to file this issue, as I do not have ready access to the internet. I have to plan on what I am going to do when I get access, so I can make the best use of my time. When getting the stuff for the book I made sure that I had Rust installed, and then I installed mdbook, and I am dreading the time in the near future where the book may say "Now cargo install some-package-with-lots-of-dependencies and look at how fast it compiles!" When all I can do is just sit there and cry inside because I have to wait a few DAYS until I can get back online.

Alas, your plight hath troubled me terribly so, you respond, but you are an insignificant minority I must say, and most people have access to the glorious internet. Thus, we can not - and shall not - help you I am sorry to say.

Okay, what about...

  • People in developing countries who want to learn to program and improve themselves.
  • Those who are behind government internet blockages (the Great Firewall of China).
  • Individuals who don't quite have enough money to pay $50/month for internet, to say nothing of TV or Netflix or the like.
  • etc...

While a PDF, EPUB or other completely offline version would be nice, simply including those *.js files locally would solve the problem and keep the formatting properly. I understand that there isn't much anyone can do about cargo install some-package-with-lots-of-dependencies without Universal Internet Access, but at least making everything local will make the learning experience much better for others.

Thank you for your time, and have a blessed day.

Online only blocked upstream

Most helpful comment

As a stop gap, I've used

wget -r --no-parent https://doc.rust-lang.org/book/second-edition/
open doc.rust-lang.org/book/second-edition/index.html

on my Mac to grab a copy for offline reading.

All 4 comments

I agree this is a problem. There are multiple potential workarounds and solutions, most of which are going to be in mdbook in general rather than the Rust book specifically:

As a stop gap, I've used

wget -r --no-parent https://doc.rust-lang.org/book/second-edition/
open doc.rust-lang.org/book/second-edition/index.html

on my Mac to grab a copy for offline reading.

May 2020 it now possible the view the book offline with

rustup docs --book

I think that allows us to close this issue ...

Just able to check this, and it works like a charm! Thank you to everyone who made this happen!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ctsa picture ctsa  路  3Comments

rafaelalvessa picture rafaelalvessa  路  5Comments

devimc picture devimc  路  4Comments

zeenix picture zeenix  路  4Comments

drandreaskrueger picture drandreaskrueger  路  4Comments