gpt4 book ai didi

python-sphinx - 如何将 Logo 添加到我的 readthedocs - 0px 宽的 Logo 渲染

转载 作者:行者123 更新时间:2023-12-04 04:31:27 27 4
gpt4 key购买 nike

这通过 sphinx 运行 readthedocs 主题在本地发生,它也发生在 readthedocs.io 中。

我添加了一个 svg Logo (实际上它只是从他们的网站复制下载的 rtd logo.svg 用于测试)。

我已将设置添加到 conf.py 并且 html 构建良好。

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_logo = 'logo.svg'
html_theme_options = {
'logo_only': True,
'display_version': False,
}

如果我在 Firefox 中检查 Logo 类,它设置为“自动”,如果我在 px 中添加宽度,则会出现 Logo 。

我觉得好像我错过了关于 conf.py 文件中 readthedocs 主题配置的一些内容?

当然,我不应该手动修改 CSS:在查看源代码时,我在 Readthedocs.io 站点中没有看到任何更改 CSS 的迹象。

我正在寻找一个优雅的解决方案 - 我不希望更新 readthedocs 主题来破坏我的网站,因为我一直在覆盖主题的 CSS。

最佳答案

你做得对

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_logo = "mepro_headshot.png"
html_theme_options = {
'logo_only': True,
'display_version': False,
}
我刚刚在我的 docs/source/ 中添加了 Logo 当你运行 make html ,它会复制您的 pngsvg文件到 docs/html/_static/ .如文档中所述: New in version 0.4.1: The image file will be copied to the _static directory of the output HTML, but only if the file does not already exist there.
├── docs
│   │   └── html
│   │   ├── _static
│   │   │   ├── mepro_headshot.png
│   │   │   ├── mepro_headshot.svg
│   └── source
│   ├── _images
│   ├── _static
│   ├── _templates
│   ├── conf.py
│   ├── index.rst
│   ├── mepro_headshot.png
│   ├── mepro_headshot.svg
似乎两者 svg enter image description here
png作品
enter image description here

关于python-sphinx - 如何将 Logo 添加到我的 readthedocs - 0px 宽的 Logo 渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59215996/

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