幻灯片的IPython笔记本:没有定义显示

时间:2015-05-08 13:42:37

标签: javascript ipython-notebook reveal.js

我正在使用nbconvert从我的笔记本中制作一个reveal.js幻灯片。具体来说,我正在运行:ipython nbconvert --to slides analysis.ipynb。这会创建“analysis.slides.html”,并将“reveal.js”放在同一个文件夹中。也就是说,我有:

  • reveal.js
    • ...
  • analysis.ipynb
  • analysis.slides.html

但是,在浏览器JavaScript控制台中打开“analysis.slides.html”时,我会得到以下结果:

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

对于加载reveal.js - <script src="reveal.js/js/reveal.js"></script>的行,我没有收到404错误 - 所以任何想法为什么我可能会看到错误?

谢谢!

2 个答案:

答案 0 :(得分:4)

this answer中看到reveal.js版本3.0.0与IPython不兼容,因此解决方案是使用旧版本,例如ipython nbconvert --to slides analysis.ipynb --reveal-prefix "http://cdn.jsdelivr.net/reveal.js/2.6.2"

答案 1 :(得分:2)

@ harshil的answer是正确的。但是如果你想要一个干净的方式与reveal.js保持同步并与jupyter(ipython notebook)一起发展,那么建立在@Lev的answer上会更好一些:

git submodule add https://github.com/hakimel/reveal.js.git
cd reveal.js
git checkout 2.6.0

当ipython升级时,你可以在reveal.js git子模块中查看新版本(标签)。