问题
I'm using nbconvert to make a reveal.js slideshow from my notebook. Specifically, I'm running: ipython nbconvert --to slides analysis.ipynb
. This creates "analysis.slides.html", and I put "reveal.js" in the same folder. That is, I have:
- reveal.js
- ...
- analysis.ipynb
- analysis.slides.html
However, when opening "analysis.slides.html" in the browser JavaScript console, I get the following:
analysis.slides.html:1992 Uncaught ReferenceError: Reveal is not defined
analysis.slides.html:2032 Uncaught ReferenceError: Reveal is not defined
require.min.js:8 Uncaught Error: Mismatched anonymous define() module: function () {
root.Reveal = factory();
return root.Reveal;
}
http://requirejs.org/docs/errors.html#mismatch
I don't get a 404 error for the line which loads reveal.js - <script src="reveal.js/js/reveal.js"></script>
- so any ideas why I might be seeing the errors I am?
Thanks!
回答1:
Saw in this answer that reveal.js version 3.0.0 isn't compatible with IPython, so the solution is to use an older version, e.g. ipython nbconvert --to slides analysis.ipynb --reveal-prefix "http://cdn.jsdelivr.net/reveal.js/2.6.2"
.
回答2:
@harshil's answer is right on. But if you want a clean way to stay up-to-date with reveal.js and evolve with jupyter (ipython notebook), building on @Lev's answer is a bit better:
git submodule add https://github.com/hakimel/reveal.js.git
cd reveal.js
git checkout 2.6.0
And when ipython upgrades, you can just checkout that new version (tag) in your reveal.js git submodule.
来源:https://stackoverflow.com/questions/30125373/ipython-notebook-to-slides-reveal-is-not-defined