IPython 笔记本到幻灯片:显示未定义
IPython notebook to slides: Reveal is not defined
我正在使用 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 的行的 404 错误 - <script src="reveal.js/js/reveal.js"></script>
- 所以你知道为什么我会看到我现在的错误吗?
谢谢!
在 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"
.
@harshil 的 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 好一点:
git submodule add https://github.com/hakimel/reveal.js.git
cd reveal.js
git checkout 2.6.0
当 ipython 升级时,您可以在 reveal.js git 子模块中检出新版本(标签)。
我正在使用 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 的行的 404 错误 - <script src="reveal.js/js/reveal.js"></script>
- 所以你知道为什么我会看到我现在的错误吗?
谢谢!
在 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"
.
@harshil 的
git submodule add https://github.com/hakimel/reveal.js.git
cd reveal.js
git checkout 2.6.0
当 ipython 升级时,您可以在 reveal.js git 子模块中检出新版本(标签)。