Skip to content

Parameter list in autodoc output has extra padding #1196

Closed
@thomascobb

Description

Problem

A multiline docstring with a parameter list in the middle has extra padding on the parameter list. This is because both .rst-content dl and .rst-content .section ul have 24px padding, giving 48px padding in the middle of a docstring output.

Reproducible Project

Repo: https://github.com/thomascobb/sphinx-rtd-them-padding-demo
Output: https://thomascobb.github.io/sphinx-rtd-them-padding-demo/

Error Logs/Results

# mycode.py

def add_numbers(a: int, b: int = 0) -> int:
    """Add two numbers together

    :param a: The first number
    :param b: The second number

    It's a very useful function
    """
    return a + b

Produces:
Screenshot 2021-08-11 at 09-55-05 API — Python documentation

Expected Results

Suppress either the .rst-content dl or .rst-content .section ul margin-bottom. The following does this, but may not be the best solution:

/* override field-list (Parameters list) to have no padding after */
dl.field-list {
    margin-bottom: 0;
}

Environment Info

  • Python Version: 3.7
  • Sphinx Version: 4.1.2
  • RTD Theme Version: 0.5.2

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions