Skip to content

Commit ea3ecaf

Browse files
committed
fix: add fenced directive break rule in list parser, #412
1 parent 45e4de6 commit ea3ecaf

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/mistune/list_parser.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,20 @@ def _parse_list_item(
9898
leading_width = len(spaces) + len(marker)
9999
text, continue_width = _compile_continue_width(text, leading_width)
100100
item_pattern = _compile_list_item_pattern(bullet, leading_width)
101+
list_item_breaks = [
102+
"thematic_break",
103+
"fenced_code",
104+
"atx_heading",
105+
"block_quote",
106+
"block_html",
107+
"list",
108+
]
109+
if 'fenced_directive' in block.specification:
110+
list_item_breaks.insert(1, "fenced_directive")
111+
101112
pairs = [
102-
("thematic_break", block.specification["thematic_break"]),
103-
("fenced_code", block.specification["fenced_code"]),
104-
("atx_heading", block.specification["atx_heading"]),
105-
("block_quote", block.specification["block_quote"]),
106-
("block_html", block.specification["block_html"]),
107-
("list", block.specification["list"]),
113+
(name, block.specification[name])
114+
for name in list_item_breaks
108115
]
109116
if leading_width < 3:
110117
_repl_w = str(leading_width)

0 commit comments

Comments
 (0)