Pygments theme clashes with Sphinx 3.0 classes

Bug #1876343 reported by Stephen Finucane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstackdocstheme
Fix Released
High
Stephen Finucane

Bug Description

Pygments assigns a short name to tokens and uses this name in stylesheets. Since Sphinx 3.0, one of these token names, '.py', is conflicting with a Sphinx class name added when using the 'py' domain [1]. Recent versions of the pygments stylesheets are more restrictive and require a '.highlight' class be present also. We should update to this style sheet.

[1] https://github.com/sphinx-doc/sphinx/commit/333596dc10ba87bd5d6d3a83f70b3b414e9e7d84

Changed in openstack-doc-tools:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstackdocstheme (master)

Fix proposed to branch: master
Review: https://review.opendev.org/724897

Changed in openstack-doc-tools:
assignee: nobody → Stephen Finucane (stephenfinucane)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstackdocstheme (master)

Reviewed: https://review.opendev.org/724897
Committed: https://git.openstack.org/cgit/openstack/openstackdocstheme/commit/?id=0b1eeda688c6b5e286c283a1fca1f6c92cac810a
Submitter: Zuul
Branch: master

commit 0b1eeda688c6b5e286c283a1fca1f6c92cac810a
Author: Stephen Finucane <email address hidden>
Date: Fri May 1 17:56:18 2020 +0100

    css: Namespace Pygments stylesheet

    The 'native.css' stylesheet is the stylesheet used by Pygments. The
    stylesheet defines a number of classes that map to the shortname of the
    tokens generated by Pygments. By default, these classes are not
    "namespaced" or prefixed by less generic selector. This is a problem
    since Sphinx 3.x has started using at least one class name that
    conflicts with one of the class names in Pygments, '.py'.

    Sphinx itself has solved this for quite some time by doing this
    "namespacing" and prepending the '.highlight' selector [1], which is the
    default class name used by Pygments' 'HTMLFormatter' formatter. Do the
    same thing ourselves by regenerating the Pygments stylesheet as
    described in the Pygments documentation [2]:

      pygmentize -f html -S native -a .highlight > native.css

    [1] https://github.com/sphinx-doc/sphinx/blob/v3.0.0/sphinx/highlighting.py#L163
    [2] https://pygments.org/docs/cmdline/#generating-styles

    Change-Id: I97731149d72b74fc4a92c0f5108c7a676f834fb8
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1876343

Changed in openstack-doc-tools:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.