let mut current_line_type: Option<LineType> = None;
for line in lines {
- let line_type = identify_line(&(line[..3]), is_preformatted);
+ let mut line_type = LineType::Text;
+ if line.len() > 2 {
+ let end = line.char_indices().map(|(i, _)| i).nth(2).unwrap();
+ line_type = identify_line(&(line[..end]), is_preformatted);
+ }
match line_type {
LineType::PreformattedToggle => is_preformatted = !is_preformatted,
_ => {