Skip to content

Commit

Permalink
Increase minimum Pygments to 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jun 16, 2022
1 parent be6166c commit 0e903b3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -19,7 +19,7 @@
'sphinxcontrib-serializinghtml>=1.1.5',
'sphinxcontrib-qthelp',
'Jinja2>=2.3',
'Pygments>=2.0',
'Pygments>=2.8.0',
'docutils>=0.14,<0.19',
'snowballstemmer>=1.1',
'babel>=1.3',
Expand Down
16 changes: 0 additions & 16 deletions sphinx/highlighting.py
Expand Up @@ -4,8 +4,6 @@
from importlib import import_module
from typing import Any, Dict

from packaging import version
from pygments import __version__ as pygmentsversion
from pygments import highlight
from pygments.filters import ErrorToken
from pygments.formatter import Formatter
Expand Down Expand Up @@ -44,20 +42,6 @@
_LATEX_ADD_STYLES = r'''
\renewcommand\PYGZsq{\textquotesingle}
'''
# fix extra space between lines when Pygments highlighting uses \fcolorbox
# add a {..} to limit \fboxsep scope, and force \fcolorbox use correct value
# cf pygments #1708 which makes this unneeded for Pygments > 2.7.4
_LATEX_ADD_STYLES_FIXPYG = r'''
\makeatletter
% fix for Pygments <= 2.7.4
\let\spx@original@fcolorbox\fcolorbox
\def\spx@fixpyg@fcolorbox{\fboxsep-\fboxrule\spx@original@fcolorbox}
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+%
{\let\fcolorbox\spx@fixpyg@fcolorbox\PYG@do{#2}}}
\makeatother
'''
if version.parse(pygmentsversion).release <= (2, 7, 4):
_LATEX_ADD_STYLES += _LATEX_ADD_STYLES_FIXPYG


class PygmentsBridge:
Expand Down

0 comments on commit 0e903b3

Please sign in to comment.