-
Notifications
You must be signed in to change notification settings - Fork 572
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
blank page when using --to slides offline #296
Comments
Ping @damianavila - I'm sure we originally intended exported slides to work offline, and there's a config setting to point it to a different revealjs location. But it looks like several hardcoded CDN URLs have crept in. |
Today I was hit by this issue too. In a few hours I have to give two talks (with slides created using ipython) in a place where won't be a stable internet connection, so I had to find an older version of ipython in which this bug doesn't happen. And to make things more complicated, that older version isn't able to open notebooks from more modern versions. In case anyone needs a temporary quick fix as me, this is what you should do (assuming you have a notebook done with recent versions of ipython):
The 2.4 step is needed because 2.0 can't open notebooks from recent versions, while 2.4 can. And then you still need to go back to 2.0, because 2.4 has the offline issues, while 2.0 doesn't. |
Thanks for the detail report @fisadev, I will look into this soon. |
A relatively clean workaround (tested with jupyter-nbconvert 4.2.0), I think:
FWIW, here are Makefile rules I use to automatically generate the templates (my local CDN lies in the all: slides_reveal_local.tpl mathjax_local.tpl jupyter-nbconvert-3.4 --to slides --post serve \ --SlidesExporter.template_file="slides_reveal_local" file.ipynb slides_reveal_local.tpl: $(shell port contents py34-nbconvert|grep slides_reveal) @echo "Remaking "$@" from "$< sed -e 's/https:\/\/cdnjs\.cloudflare\.com\/ajax\/libs/CDN/' \ -e 's/\/\/netdna\.bootstrapcdn\.com/CDN/' \ -e 's/mathjax\.tpl/mathjax_local.tpl/' $< > $@ mathjax_local.tpl: $(shell port contents py34-nbconvert|grep mathjax) @echo "Remaking "$@" from "$< sed -e 's/https:\/\/cdn\.mathjax\.org\/mathjax\/latest/CDN\/MathJax/' \ $< > $@ This does not (yet) handle the problem of Google's fonts. |
Currently, in the last released version of nbconvert you can pass custom stuff for jquery, font-awesome and require: https://github.com/jupyter/nbconvert/blob/master/nbconvert/exporters/slides.py#L106-L131. Still we need to figure out the fonts and mathjax cases and test all locally. |
@damianavila Shouldn't the MathJax case be straightforward like adding an option as follows? c = get_config()
c.SlidesExporter.mathjax_url = './CDN/MathJax-2.7.1/MathJax.js' Since this not solved yet, let me extend @deroulers 's workaround to a more generic Makefile for nearly all POSIX platforms. I have assumed the same local directory NBCONVERT_ROOT := $(shell pip show nbconvert | awk '/Location/{printf("%s/%s", $$2, "nbconvert")}')
CDN/%.tpl: $(NBCONVERT_ROOT)/templates/html/%.tpl
cp -f $< $@
sed -i -e 's/https:\/\/cdnjs\.cloudflare\.com\/ajax\/libs/CDN/' $@
cleantpl:
rm -f CDN/*.tpl
localize: cleantpl CDN/mathjax.tpl CDN/slides_reveal.tpl
sed -i -e 's/mathjax\/2\.7\.1/MathJax-2\.7\.1/' CDN/mathjax.tpl Note that the above rules expects a MathJax-2.7.1 directory extracted from the release. Get it as follows: wget https://github.com/mathjax/MathJax/archive/2.7.1.tar.gz -o CDN/MathJax-2.7.1.tar.gz
tar -xf CDN/MathJax-2.7.1.tar.gz -C CDN Also add this to the configuration file: |
I have made a hacky solution to convert notebook to offline slides. |
(Not a duplicate of #91)
Online this steps works flawlessly for me:
But when I pull the network cord, clear all browser history (cache, ...) open same html... then blank page.
Attach network cord, refresh browser. All good again.
I need to show the slides in a offline location. I Keep trying (with the same result):
Looking what the slides get from the net. I get:
No mention of this in the docs http://nbconvert.readthedocs.org/en/latest/usage.html#convert-revealjs.
If any of this (require.js, jquery, MathJax, fonts) could be added manually. Please document how.
My environment for this issue:
Ipython
python -c "import IPython; print(IPython.sys_info())"
Virtualenv
Browser
The text was updated successfully, but these errors were encountered: