Skip to content

Commit 2aba189

Browse files
authored
Fix list patterns in FancyList (#2576)
Prevent detecting a list when a line starts with `.` or `)`. Fixes #2575
1 parent b5d3826 commit 2aba189

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

docs/src/markdown/about/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 10.14.2
4+
5+
- **FIX**: FancyLists: Fix case were lists could be falsely created when a line started with `.` or `)`.
6+
37
## 10.14.1
48

59
- **FIX**: MagicLink: Ensure that repo names that start with `.` are handled correctly.

pymdownx/__meta__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,5 @@ def parse_version(ver, pre=False):
185185
return Version(major, minor, micro, release, pre, post, dev)
186186

187187

188-
__version_info__ = Version(10, 14, 1, "final")
188+
__version_info__ = Version(10, 14, 2, "final")
189189
__version__ = __version_info__._get_canonical()

pymdownx/fancylists.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def __init__(self, parser, config):
109109
(?:C[MD]|D(?:C{0,4}|C{5}\b)|(?:C{0,9}|C{10}\b))
110110
(?:X[CL]|L(?:X{0,4}|X{5}\b)|(?:X{0,9}|X{10}\b))
111111
(?:I[XV]|V(?:I{0,4}|I{5}\b)|(?:I{0,9}|I{10}\b))
112-
| m*
112+
| (?=[ivxlcdm])
113+
m*
113114
(?:c[md]|d(?:c{0,4}|c{5}\b)|(?:c{0,9}|c{10}\b))
114115
(?:x[cl]|l(?:x{0,4}|x{5}\b)|(?:x{0,9}|x{10}\b))
115116
(?:i[xv]|v(?:i{0,4}|i{5}\b)|(?:i{0,9}|i{10}\b))

tests/test_extensions/test_fancylists.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,30 @@ class TestFancyLists(util.MdCase):
88
extension = ['pymdownx.fancylists', 'pymdownx.saneheaders']
99
extension_configs = {}
1010

11+
def test_fail_case(self):
12+
"""Test failed case."""
13+
14+
self.check_markdown(
15+
"""
16+
1. foo
17+
. bar
18+
19+
1) foo
20+
) bar
21+
""",
22+
"""
23+
<ol type="1">
24+
<li>foo
25+
. bar</li>
26+
</ol>
27+
<ol type="1">
28+
<li>foo
29+
) bar</li>
30+
</ol>
31+
""",
32+
True
33+
)
34+
1135
def test_unordered(self):
1236
"""Test unordered lists."""
1337

0 commit comments

Comments
 (0)