我有以下代码将目录添加到ipython笔记本的开头。当我在计算机上的jupyter上运行单元时,我得到
但是当我将笔记本上载到github并选择查看笔记本时,我在第一个单元格中看到了这一点。
有没有一种方法可以强制此javascript行在github上像第一张图片一样运行?
答案 0 :(得分:1)
“是否有一种方法可以强制此javascript行在github上像第一张图片一样运行?”
...不,Github不是为此设计的。您不能在其上运行代码。仅用于共享目的。如果要在网站上运行代码,请将其上传到CodePen,JS Fiddle或JS Bin
答案 1 :(得分:0)
对于将来偶然发现此问题的任何人,都有解决方案。 Github不会在.ipynb文件中运行javascript扩展,但这就是nbviewer所使用的。只需将github上文件的URL输入到nbviewer主网站。
例如,检查内容javascript扩展表(第一个单元格)如何在nbviewer上运行
但不在github
上