Man*_*ral 3 html reveal.js server jupyter-notebook
我目前正在开发 Jupyter Notebook。我设法将其导出为 Reveal.js 幻灯片 (.html) 并将其托管在我的本地服务器上。我在终端中使用了以下命令行:
jupyter nbconvert <mynotebookname>.ipynb --to slides --post serve
Run Code Online (Sandbox Code Playgroud)
它生成一个<mynotebookname>.slides.html文件并在浏览器中打开它,我可以在其中正确浏览幻灯片(如https://revealjs.com上的示例所示)。
但是,如果我将此文件上传到大学服务器上的“web”文件夹(我通常上传任何我想作为网页查看的 html 文件),我会得到一个包含笔记本内容的可滚动页面。它不提供与本地服务器上相同的幻灯片视角。
我想将其作为网页提供,以便我可以与其他人分享。我缺少什么?
我终于通过使用以下命令找到了解决方案:
jupyter nbconvert <mynotebookname>.ipynb --to slides --reveal-prefix "https://cdn.jsdelivr.net/npm/reveal.js@3.6.0 "
Run Code Online (Sandbox Code Playgroud)
这样,生成的 Slides.html 文件将在浏览器中正确呈现幻灯片,无论该文件是作为独立文件在本地计算机上还是在 Webserver/github/bitbucket 上显示为网页。
我不知道在不使用时--post serve有必要将reveal-prefix指向CDN(内容分发网络)上可用的一些reveal.js库。显然--post serve是为你做的。作为替代方案,也可以指向本地reveal.js 库。
以下是一些帮助我实现此解决方案的链接。它们包含一些在将笔记本转换为幻灯片时可能有用的附加命令。
https://github.com/jupyter/nbconvert/issues/157
https://github.com/jupyter/nbconvert/blob/master/docs/source/usage.rst
http://www.damian.oquanta.info/posts/using-a-local-revealjs-library-with-your-ipython-slides.html
| 归档时间: |
|
| 查看次数: |
1967 次 |
| 最近记录: |