gpt4 book ai didi

html - 在非本地服务器上将 reveal.js 幻灯片 (.html) [Jupyter 笔记本导出] 作为网页托管

转载 作者:行者123 更新时间:2023-12-05 02:15:31 24 4
gpt4 key购买 nike

我目前正在开发 Jupyter Notebook。我设法将其导出为 reveal.js 幻灯片 (.html) 并将其托管在我的本地服务器上。我在终端中使用了以下命令行:

jupyter nbconvert <mynotebookname>.ipynb --to slides --post serve

它生成一个 <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 "

这样生成的 slides.html 文件将在您的浏览器中正确呈现幻灯片,无论该文件是作为独立文件在您的本地计算机上还是作为网页显示在网络服务器/github/bitbucket 上。

我不知道当不使用 --post serve 时,有必要将 reveal-prefix 指向 CDN(内容分发网络)上可用的一些 reveal.js 库。显然 --post serve 会为您做这件事。作为替代方案,也可以指向本地 reveal.js 库。

以下是帮助我找到此解决方案的一些链接。它们包含一些在将笔记本转换为幻灯片时可能有用的附加命令。

https://github.com/jupyter/nbconvert/issues/157

https://medium.com/learning-machine-learning/present-your-data-science-projects-with-jupyter-slides-75f20735eb0f

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

关于html - 在非本地服务器上将 reveal.js 幻灯片 (.html) [Jupyter 笔记本导出] 作为网页托管,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51772410/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com