Skip to content

Line numbers are misaligned on several Sphinx themes #1579

@mgeier

Description

@mgeier

A change in Sphinx (sphinx-doc/sphinx#7482) combined with a change in Pygments (#1477) has led to a wrong alignment of line numbers.

This happens with Pygments 2.7+ and Sphinx 3.1+.

See sphinx-doc/sphinx#8254 for details including screenshots.

So far, I've found these Sphinx themes to be affected:

 

I'm not sure whether this should be fixed in Sphinx or in Pygments (or both?), but I found out that disabling this chunk of CSS (which comes from Pygments) seems to fix the problem for most themes (I didn't try all, though):

td.linenos pre {
    color: #000000;
    background-color: #f0f0f0;
    padding: 0 5px 0 5px;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions