Sphinx documentation showing double-colon in fields

663 Views Asked by At

I am developing documentation for a package and when I build the sphinx docs I'm getting double colons

double colons

for all of the fields for every function definition.

I am using the numpydoc style for my docstrings and there are no colons in those docs to indicate where they might be coming from:

    """

    Function description

    Parameters
    -----------
    param1: str or list
        A description for the parameter

    Returns
    -----------
    Dictionary
        Some info about what is returned

    Examples
    -----------
        >>> output = somefunction(param1)

    """

Has anyone run into this before? It's worth noting that this does not happen to the Examples field. Just Parameters, Returns, and Return Type.

2

There are 2 best solutions below

1
sarusso On

Seems like to be a bug of some versions. I moved from Sphinx 3.5.2 to 4.4.0 and the double colons are gone.

0
Romain On

I had the same problem with Sphinx 5.0.2. When inspecting the HTML file, it looks like a CSS rule adds a semicolon (::after) using:

dl.field-list > dt:after {
    content: ":";
}

I got rid of that behavior by overriding this rule in my custom css style sheet:

dl.field-list > dt:after {
    content: "";
}

It is obviously not the best solution but it did the job for me.