Skip to content

Commit

Permalink
Fix SuperFence pattern should require options to be separated by a sp…
Browse files Browse the repository at this point in the history
…ace (#2480)
  • Loading branch information
facelessuser authored Oct 1, 2024
1 parent 96e19e6 commit a994065
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/src/markdown/about/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 10.11.2

- **FIX**: SuperFences: Fix a regression where certain patterns could cause a hang.

## 10.11.1

- **Fix**: SuperFences: Fix regression where an omitted language in conjunction with options in the fenced header
Expand Down
2 changes: 1 addition & 1 deletion pymdownx/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,5 @@ def parse_version(ver, pre=False):
return Version(major, minor, micro, release, pre, post, dev)


__version_info__ = Version(10, 11, 1, "final")
__version_info__ = Version(10, 11, 2, "final")
__version__ = __version_info__._get_canonical()
4 changes: 2 additions & 2 deletions pymdownx/superfences.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
(?P<fence>~{3,}|`{3,})
(?:[ \t]*\.?(?P<lang>[\w#.+-]+)(?=[\t ]|$))? # Language
(?:
[ \t]*(\{(?P<attrs>[^\n]*)\}) | # Optional attributes or
[ \t]*(\{(?P<attrs>[^\n]*)\}) | # Optional attributes or
(?P<options>
(?:
(?:[ \t]*[a-zA-Z][a-zA-Z0-9_]*(?:=(?P<quot>"|').*?(?P=quot))?) # Options
(?:[ \t]*[a-zA-Z][a-zA-Z0-9_]*(?:=(?P<quot>"|').*?(?P=quot))?)(?=[\t ]|$) # Options
)+
)
)?[ \t]*$
Expand Down
11 changes: 11 additions & 0 deletions tests/test_extensions/test_superfences.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,17 @@ def test_attrs_alternate_form(self):
True
)

def test_issue_2479(self):
"""Test issue #2479."""

self.check_markdown(
"""```test_test_test_test_test_test_test_test``` test test.""",
"""
<p><code>test_test_test_test_test_test_test_test</code> test test.</p>
""",
True
)


class TestSuperFencesClassesIdsAttrList(util.MdCase):
"""Test fence ids and classes with attribute lists."""
Expand Down

0 comments on commit a994065

Please sign in to comment.