简体   繁体   English

API 文档中 Furo Sphinx 主题大写太多

[英]Furo Sphinx theme uppercases too much in API documentation

I am a beginner in documentation with Sphinx.我是 Sphinx 文档的初学者。 I wanted to produce numpy style documentations.我想制作 numpy 风格的文档。 Therefore, I used numpydoc extension.因此,我使用了 numpydoc 扩展名。 Numpy uses pydata theme, however I chose furo . Numpy 使用pydata主题,但是我选择了furo I understand that there will be some differences in appearance, but I expected my page to have the same format as numpy's at least, though I get the parameter names, and types capitalized.我知道外观上会有一些差异,但我希望我的页面至少与 numpy 的格式相同,尽管我得到了参数名称和大写类型。 Descriptions are not capitalized.描述没有大写。

My docstring:我的文档字符串:

def translate_pointcloud(pointcloud):
    """
    A data augmentation technique that translates the pointcloud randomly.

    Parameters
    ----------
    pointcloud : numpy.ndarray
    
    See Also
    --------
    rotate_pointcloud, jitter_pointcloud
    """

But I have this:但我有这个: 图片

In my conf.py I use:在我的 conf.py 我使用:

extensions = [
    'sphinx.ext.duration',
    'sphinx.ext.doctest',
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'numpydoc',
    ]
html_theme = 'furo'

What am I doing wrong?我究竟做错了什么? Is it because of the theme?是因为主题吗? Is there an easy fix?有没有简单的解决方法?

It's definitely the theme.这绝对是主题。 Probably an oversight, or even a bug, as Furo shouldn't change capitalization of identifiers and types in the API documentation.可能是疏忽,甚至是错误,因为 Furo 不应更改 API 文档中标识符和类型的大小写。 But it does, here , by applying the CSS property text-transform: uppercase .在这里,它通过应用 CSS 属性text-transform: uppercase

You can override it with a custom style.您可以使用自定义样式覆盖它。 In your docs folder, create a subfolder style , and in it a file custom.css with this content:在您的docs文件夹中,创建一个子文件夹style ,并在其中创建一个包含以下内容的文件custom.css

dl.py .field-list dt {
    text-transform: none;
}

Then add these two lines to Sphinx's configuration file conf.py :然后将这两行添加到 Sphinx 的配置文件conf.py

html_static_path = ['style']
html_css_files   = ['custom.css']

The rendered output will look something like this:渲染的输出看起来像这样:

截屏

I've tried the accepted solution but it is not working.我已经尝试了公认的解决方案,但它不起作用。 It seems that the theme is overwriting the custom settings.似乎主题正在覆盖自定义设置。 Is there something I can do to fix that?我能做些什么来解决这个问题吗?

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM