有没有办法从sphinx中删除"查看页面源"链接生成阅读文档主题页面?
还有一个类似的问题在这里并建议寻找面包屑文件,但我无法找到一个
luc*_*esg 12
在conf.py文件中,尝试将变量设置conf.py为False,
html_show_sourcelink = False
Run Code Online (Sandbox Code Playgroud)
如果它不存在,只需创建它.然后,再次编译项目,
$ make html
Run Code Online (Sandbox Code Playgroud)
不要被配置所迷惑。你可以看看源代码。
事实上,从Sphinx的HTML主题支持开始,它就介绍了一个主题的结构应该是这样的。
[theme]
inherit = base theme
stylesheet = main CSS name
pygments_style = stylename
sidebars = localtoc.html, relations.html, sourcelink.html, searchbox.html
...
Run Code Online (Sandbox Code Playgroud)
这是site-packages/sphinx_rtd_theme/theme.conf
[theme]
inherit = basic
stylesheet = css/theme.css
pygments_style = default
Run Code Online (Sandbox Code Playgroud)
所以我们知道它的侧边栏完全继承自basic。
什么是基本?狮身人面像的主题之一。
site-packages/sphinx/theme/ {基本,自然...}
site-packages/sphinx/themes/basic/sourcelink.html的内容
[theme]
inherit = base theme
stylesheet = main CSS name
pygments_style = stylename
sidebars = localtoc.html, relations.html, sourcelink.html, searchbox.html
...
Run Code Online (Sandbox Code Playgroud)
(如果您对这种格式感到困惑,请参考这里:jinja))
然后,我们知道当且仅当show_source, has_source,sourcename全部为 True 时才显示。
什么是show_source,has_source,sourcename?
如果您的格式是 HTML,那么它来自:sphinx.builders.html StandaloneHTMLBuilder
其中,他创建了一个变量globalcontext,见下图:
[theme]
inherit = basic
stylesheet = css/theme.css
pygments_style = default
Run Code Online (Sandbox Code Playgroud)
如果您想查看完整代码,请点击链接
现在,我想你已经明白了。
has_source是html_copy_source
show_source是html_show_sourcelink
和sourcename = ... if html_copy_source else ''
所以,接近的方式有两种,都可以。
html_copy_source = False(因为has_source + html_copy_source)html_show_sourcelink = False(因为show_source + htm_show_sourcelink)(或 3. 两个 eq 均为 False ...)
| 归档时间: |
|
| 查看次数: |
1246 次 |
| 最近记录: |