【问题标题】:IPython notebook to slides: Reveal is not defined幻灯片的 IPython 笔记本:未定义显示
【发布时间】:2015-05-08 13:42:37
【问题描述】:

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

  • 显示.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错误 - 所以有什么想法为什么我可能会看到我的错误?

谢谢!

【问题讨论】:

    标签: javascript ipython-notebook reveal.js


    【解决方案1】:

    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".

    【讨论】:

    • 请注意,您可能必须使用https://cdn.jsdelivr.net/reveal.js/2.6.2(注意https)。至少在我的情况下,没有它,我无法获得任何 jsdelivr 内容。
    【解决方案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 子模块中签出新版本(标签)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-12
      • 2019-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-18
      相关资源
      最近更新 更多