Skip to content

Commit 82b0a68

Browse files
authored
Revert "Update pygments version constraint in pyproject.toml" (#8979)
1 parent d0f0dc2 commit 82b0a68

4 files changed

Lines changed: 16 additions & 23 deletions

File tree

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ py-snapshots:
138138
uv run --group test pytest \
139139
tests/_server/templates/test_templates.py \
140140
tests/_server/api/endpoints/test_export.py \
141-
tests/test_api.py \
142-
tests/test_project_dependencies.py
141+
tests/test_api.py
143142

144143
##############
145144
# Packaging #

marimo/_output/md.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PyconDetectorExtension(markdown.Extension):
3535
def extendMarkdown(self, md: markdown.Markdown) -> None:
3636
"""Add the preprocessor to the markdown instance."""
3737
processor = PyconDetectorPreprocessor(md)
38-
md.preprocessors.register(processor, "pycon_detector", 175)
38+
md.preprocessors.register(processor, "pycon_detector", 30)
3939

4040

4141
class PyconDetectorPreprocessor(markdown.preprocessors.Preprocessor):
@@ -53,12 +53,9 @@ class PyconDetectorPreprocessor(markdown.preprocessors.Preprocessor):
5353

5454
def __init__(self, md: markdown.Markdown) -> None:
5555
super().__init__(md)
56-
# Pattern to match fenced code blocks (backreference \2 ensures the
57-
# closing fence matches the opening fence marker, preventing greedy
58-
# over-consumption of adjacent fenced blocks)
56+
# Pattern to match fenced code blocks
5957
self.fence_pattern = re.compile(
60-
r"^(\s*)(```+|~~~+)(\w*)\s*\n(.*?)^\s*\2\s*$",
61-
re.MULTILINE | re.DOTALL,
58+
r"^(\s*)```(\w*)\s*\n(.*?)^(\s*)```\s*$", re.MULTILINE | re.DOTALL
6259
)
6360

6461
def run(self, lines: list[str]) -> list[str]:
@@ -67,14 +64,14 @@ def run(self, lines: list[str]) -> list[str]:
6764

6865
def replace_fence(match: re.Match[str]) -> str:
6966
indent = match.group(1)
70-
fence = match.group(2)
71-
language = match.group(3) or ""
72-
code = match.group(4)
67+
language = match.group(2) or ""
68+
code = match.group(3)
7369

7470
# Only process if no language is specified
75-
if not language and self._detect_pycon(code):
76-
# Replace with pycon language
77-
return f"{indent}{fence}pycon\n{code}{indent}{fence}"
71+
if not language:
72+
if self._detect_pycon(code):
73+
# Replace with pycon language
74+
return f"{indent}```pycon\n{code}{indent}```"
7875

7976
# Return original
8077
return match.group(0)
@@ -253,10 +250,7 @@ def __init__(
253250
text,
254251
extensions=_get_extensions(),
255252
extension_configs=_get_extension_configs(),
256-
)
257-
if html_text is None:
258-
html_text = ""
259-
html_text = html_text.strip()
253+
).strip()
260254
# replace <p> tags with <span> as HTML doesn't allow nested <div>s in <p>s
261255
html_text = html_text.replace(
262256
"<p>", '<span class="paragraph">'

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ dependencies = [
1717
# compile markdown to html
1818
"markdown>=3.6,<4",
1919
# add features to markdown
20-
# 10.21.2+ required for compatibility with pygments>=2.20 (filename=None fix).
21-
"pymdown-extensions>=10.21.2,<11",
20+
# Pinned to specific version for introduction of codeblock handling.
21+
"pymdown-extensions>=10.15,<11",
2222
# syntax highlighting of code in markdown
23-
"pygments>=2.20,<3",
23+
"pygments>=2.19,<3",
2424
# for reading, writing configs
2525
"tomlkit>=0.12.0",
2626
# for managing frontmatter headers in markdown

tests/snapshots/dependencies.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ msgspec>=0.20.0
88
narwhals>=2.0.0
99
packaging
1010
psutil>=5.0
11-
pygments>=2.20,<3
12-
pymdown-extensions>=10.21.2,<11
11+
pygments>=2.19,<3
12+
pymdown-extensions>=10.15,<11
1313
pyyaml>=6.0.1
1414
pyzmq>=27.1.0; python_version < '3.15'
1515
starlette>=0.37.2

0 commit comments

Comments
 (0)