2

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: image

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?

mzjn
  • 48,958
  • 13
  • 128
  • 248
  • I just switched to pydata theme. It fixed the problem, but it would be nice if it also worked for the 'furo' theme. – Kaan Güven Nov 07 '21 at 15:44
  • 1
    Having `PARAMETERS` in all uppercase seems to be a deliberate style choice (example: https://urllib3.readthedocs.io/en/stable/reference/urllib3.poolmanager.html). But the names of types and identifiers should be left alone. See also https://github.com/pradyunsg/furo/discussions/233. – mzjn Nov 08 '21 at 16:55

1 Answers1

4

Note: The issue has been fixed in Furo 2022.1.2.


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;
}

(With Furo versions released more recently than when this question was asked, you'll have to use none !important; instead of just none;. See the follow-up question as to why.)

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:

screenshot

john-hen
  • 4,410
  • 2
  • 23
  • 40