Skip to content

Commit cee71b8

Browse files
authored
fix(scanner): allow ordered lists to start from any number (#226)
1 parent bd2d09e commit cee71b8

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

tree-sitter-markdown/src/scanner.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ static bool parse_ordered_list_marker(Scanner *s, TSLexer *lexer,
735735
valid_symbols[LIST_MARKER_PARENTHESIS_DONT_INTERRUPT] ||
736736
valid_symbols[LIST_MARKER_DOT_DONT_INTERRUPT])) {
737737
size_t digits = 1;
738-
bool dont_interrupt = lexer->lookahead != '1';
738+
bool dont_interrupt = !isdigit(lexer->lookahead);
739739
advance(s, lexer);
740740
while (isdigit(lexer->lookahead)) {
741741
dont_interrupt = true;

tree-sitter-markdown/test/corpus/issues.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,58 @@ globalNS.method1(5, 10);
114114
(fenced_code_block_delimiter))
115115
(paragraph
116116
(inline))))
117+
118+
================================================================================
119+
#226 (PR) - Allow ordered lists to start from any number
120+
================================================================================
121+
122+
* List item
123+
0) Zero
124+
1) One
125+
2) Two
126+
127+
* Backwards list
128+
9) Nine
129+
8) Eight
130+
131+
--------------------------------------------------------------------------------
132+
133+
(document
134+
(section
135+
(list
136+
(list_item
137+
(list_marker_star)
138+
(paragraph
139+
(inline)
140+
(block_continuation))
141+
(list
142+
(list_item
143+
(list_marker_parenthesis)
144+
(paragraph
145+
(inline)
146+
(block_continuation)))
147+
(list_item
148+
(list_marker_parenthesis)
149+
(paragraph
150+
(inline)
151+
(block_continuation)))
152+
(list_item
153+
(list_marker_parenthesis)
154+
(paragraph
155+
(inline)
156+
(block_continuation)))))
157+
(list_item
158+
(list_marker_star)
159+
(paragraph
160+
(inline)
161+
(block_continuation))
162+
(list
163+
(list_item
164+
(list_marker_parenthesis)
165+
(paragraph
166+
(inline)
167+
(block_continuation)))
168+
(list_item
169+
(list_marker_parenthesis)
170+
(paragraph
171+
(inline))))))))

0 commit comments

Comments
 (0)