@@ -5,7 +5,7 @@ class Markdown::Parser
5
5
@lines : Array (String )
6
6
7
7
def initialize (text : String , @renderer : Renderer )
8
- @lines = text.lines.map & .chomp
8
+ @lines = text.lines
9
9
@line = 0
10
10
end
11
11
@@ -210,6 +210,8 @@ class Markdown::Parser
210
210
@renderer .begin_unordered_list
211
211
212
212
while true
213
+ break unless starts_with_bullet_list_marker?(@lines [@line ], prefix)
214
+
213
215
join_next_lines continue_on: nil , stop_on: UnorderedList .new(prefix)
214
216
line = @lines [@line ]
215
217
@@ -223,8 +225,6 @@ class Markdown::Parser
223
225
next
224
226
end
225
227
226
- break unless starts_with_bullet_list_marker?(line, prefix)
227
-
228
228
if line.starts_with?(" " ) && previous_line_is_not_intended_and_starts_with_bullet_list_marker?(prefix)
229
229
@renderer .begin_unordered_list
230
230
end
@@ -253,6 +253,8 @@ class Markdown::Parser
253
253
@renderer .begin_ordered_list
254
254
255
255
while true
256
+ break unless starts_with_digits_dot? @lines [@line ]
257
+
256
258
join_next_lines continue_on: nil , stop_on: :ordered_list
257
259
line = @lines [@line ]
258
260
@@ -266,8 +268,6 @@ class Markdown::Parser
266
268
next
267
269
end
268
270
269
- break unless starts_with_digits_dot? line
270
-
271
271
@renderer .begin_list_item
272
272
process_line line.byte_slice(line.index('.' ).not_nil! + 1 )
273
273
@renderer .end_list_item
0 commit comments