如何将徽标添加到我的ReadtheDocs-0px宽的徽标渲染 [英] How to add a logo to my readthedocs - logo rendering at 0px wide

查看:24
本文介绍了如何将徽标添加到我的ReadtheDocs-0px宽的徽标渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我已经添加了一个SVG徽标(实际上它只是从他们的网站复制的下载的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中检查徽标类,它被设置为"自动",如果我在px中添加宽度,徽标就会出现。

我觉得我好像遗漏了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/中添加了徽标,当您运行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

png工作

这篇关于如何将徽标添加到我的ReadtheDocs-0px宽的徽标渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆