【问题标题】:Link from One GitHub Jupyter Notebook to Another in the Same Repo从一个 GitHub Jupyter Notebook 链接到同一存储库中的另一个
【发布时间】:2022-04-15 03:11:25
【问题描述】:

有没有什么方法可以在 GitHub 上从一个 Jupyter notebook 本地链接到另一个,而无需嵌入绝对路径,例如 https://github.com/jeffheaton/test-linking/blob/main/notebook1.ipynb

我创建了一个笔记本 (notebook1.ipynb)

有了这个内容:

# This is Notebook 1

* [Link to Notebook 2a](notebook2.ipynb)
* [Link to Notebook 2b](./notebook2.ipynb))

我尝试了两种不同的方法,一种使用 .对于当前目录。都没有用。

notebook2.ipynb 其实就是这个网址:

https://github.com/jeffheaton/test-linking/blob/main/notebook2.ipynb

但是,GitHub 将我的链接转换为:

https://notebooks.githubusercontent.com/view/notebook2.ipynb

这会导致错误的链接。

如果我将相同的降价代码放入 README.md 中,它就可以正常工作。只是似乎不喜欢 jupyter 笔记本。

我真的不想在所有内容前加上https://github.com/jeffheaton/test-linking/blob/main/,因为本地链接:

  • 在 GitHub 之外的本地工作
  • 在 GitHub 上与分支无关

你可以在这个简短的 repo 中看到我尝试完成这项工作:https://github.com/jeffheaton/test-linking

【问题讨论】:

    标签: github markdown jupyter


    【解决方案1】:

    如果有人遇到这个问题。 GitHub 解决了这个问题,相对链接现在似乎可以正常工作了。

    【讨论】:

    • 目前最好将 GitHub 的“视图”视为基本预览。它有很多问题,解决所有问题并不是他们的首要任务。 Nbviewer 是用于查看“静态”渲染的 Jupyter 产品,它提供了更好的体验:为新手提供更清晰的界面,允许嵌入式 javascript,因此情节图仍然有效,等等。相对链接也有效,如 here 所示。跨度>
    • 您可以通过将您的 URL 粘贴到 the main nbviewer page 然后获取出现的页面的 URL 来创建这些链接,或者请注意您只需将 URL 的 https://github.com/ 部分更改为您的 Github页面到https://nbviewer.org/github。然后你可以把这些链接放在markdown here
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-05
    • 1970-01-01
    • 1970-01-01
    • 2019-08-04
    • 1970-01-01
    • 2012-10-05
    • 1970-01-01
    相关资源
    最近更新 更多