简体   繁体   中英

Furo Sphinx theme uppercases too much in API documentation

I am a beginner in documentation with Sphinx. I wanted to produce numpy style documentations. Therefore, I used numpydoc extension. Numpy uses pydata theme, however I chose 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. 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:

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. But it does, here , by applying the CSS property 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:

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

Then add these two lines to Sphinx's configuration file 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?

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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