From 4e6eee4da9ff4a5727b0b7c38a017f625fb204c2 Mon Sep 17 00:00:00 2001 From: talklittle Date: Thu, 18 Sep 2025 09:10:25 +0000 Subject: [PATCH] Update Pygments to 2.19.2 (was 2.9.0) See merge request tildes/tildes!174 --- tildes/requirements-dev.txt | 2 +- tildes/requirements.in | 2 +- tildes/requirements.txt | 2 +- tildes/tildes/lib/markdown.py | 11 +++++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tildes/requirements-dev.txt b/tildes/requirements-dev.txt index 468cac2..2c0ef37 100644 --- a/tildes/requirements-dev.txt +++ b/tildes/requirements-dev.txt @@ -78,7 +78,7 @@ pycparser==2.22 pydocstyle==6.3.0 pyflakes==3.4.0 pygit2==1.18.1 -pygments==2.9.0 +pygments==2.19.2 pylint==3.3.8 pylint-celery==0.3 pylint-django==2.6.1 diff --git a/tildes/requirements.in b/tildes/requirements.in index 4401b49..15af711 100644 --- a/tildes/requirements.in +++ b/tildes/requirements.in @@ -17,7 +17,7 @@ prometheus-client psycopg2 publicsuffix2==2.20160818 pygit2 -Pygments==2.9.0 # TODO: Upgrade Pygments, new version causes an error on posting a code block +Pygments pyotp pyramid<2.0 pyramid-ipython diff --git a/tildes/requirements.txt b/tildes/requirements.txt index f0b1db8..4e73db4 100644 --- a/tildes/requirements.txt +++ b/tildes/requirements.txt @@ -55,7 +55,7 @@ publicsuffix2==2.20160818 pure-eval==0.2.3 pycparser==2.22 pygit2==1.18.1 -pygments==2.9.0 +pygments==2.19.2 pyotp==2.9.0 pyproject-hooks==1.2.0 pyramid==1.10.8 diff --git a/tildes/tildes/lib/markdown.py b/tildes/tildes/lib/markdown.py index 3e9d1c7..36d985b 100644 --- a/tildes/tildes/lib/markdown.py +++ b/tildes/tildes/lib/markdown.py @@ -255,12 +255,15 @@ class CodeHtmlFormatter(HtmlFormatter): ... instead (assumes a
 is already present).
     """
 
-    def wrap(self, source: Any, outfile: Any) -> Iterator[tuple[int, str]]:
+    def wrap(self, source: Any) -> Iterator[tuple[int, str]]:
         """Wrap the highlighted tokens with the  tag."""
-        # pylint: disable=unused-argument
-        yield (0, '')
+        yield 0, ''
         yield from source
-        yield (0, "")
+        yield 0, ""
+
+    def _wrap_div(self, inner: Any) -> Iterator[tuple[int, str]]:
+        """Override HtmlFormatter to omit the wrapping 
.""" + yield from inner def apply_syntax_highlighting(html: str) -> str: