gpt4 book ai didi

python-sphinx - 使用 Read The Docs & Sphinx 和 ReadTheDocs 主题时删除在 Github 上的编辑链接

转载 作者:行者123 更新时间:2023-12-01 08:53:08 28 4
gpt4 key购买 nike

我试图找出如何使用 Sphinx 中的 _template overrides 选项来覆盖默认的 ReadTheDocs 主题,以便在 http://readthedocs.org 上托管 Sphinx 文档。

具体来说,我想删除/隐藏此主题右上角显示的“在 Github 上编辑”链接。

任何提示将非常感谢!谢谢!

我已经在这里查看了文档: http://www.sphinx-doc.org/en/stable/templating.html ,但是,我很难过,真的需要一些帮助。

谢谢!

最佳答案

好的,我想通了,所以我会回答我自己的询问,希望能帮助其他人。

假设您使用的是 ReadTheDocs 默认主题,这应该可以正常工作。

  • 将 ReadTheDocs 主题从 Github 存储库克隆到您的计算机。 ( https://github.com/snide/sphinx_rtd_theme/ )
  • 定位 breadcrumbs.html 文件 (https://github.com/snide/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/breadcrumbs.html)
  • breadcrumbs.html 文件添加到 _templates 文件夹中的 Sphinx 文档文件夹中。如果此目录尚不存在,则需要创建它。
  • 在你的 conf.py 文件中找到你的 html_context 部分,如果你还没有这个,你可以创建它。 (示例链接如下)。
    html_context = {
    "display_github": False, # Add 'Edit on Github' link instead of 'View page source'
    "last_updated": True,
    "commit": False,
    }
  • 使用 breadcrumbs.html
  • Git 文件添加到您的跟踪文件中
  • 提交对 conf.py
  • 的更改
  • 推送到远程 Github 仓库
  • 利润

  • 引用
  • https://github.com/duelingdogs/dueling-docs/blob/master/source/conf.py#L36-L40
  • http://help.duelingdogs.net/en/latest/(示例显示现在删除了 Edit on Github 选项。
  • 关于python-sphinx - 使用 Read The Docs & Sphinx 和 ReadTheDocs 主题时删除在 Github 上的编辑链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36019670/

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