Skip to content

Commit 470680f

Browse files
shulaodafee1-dead
andauthored
Update src/comment.rs
Co-authored-by: beef <ent3rm4n@gmail.com>
1 parent 06f67c2 commit 470680f

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/comment.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -552,17 +552,7 @@ impl ItemizedBlock {
552552
/// The original line_start likely contains indentation (whitespaces), which we'd like to
553553
/// replace with '> ' characters.
554554
fn itemized_block_quote_start(line: &str, mut line_start: String, remove_indent: usize) -> String {
555-
let mut quote_level = 0;
556-
let mut chars = line.trim_start().chars().peekable();
557-
558-
while chars.peek() == Some(&'>') {
559-
chars.next();
560-
quote_level += 1;
561-
// Skip all spaces after '>'
562-
while chars.peek() == Some(&' ') {
563-
chars.next();
564-
}
565-
}
555+
let quote_level = line.chars().take_while(|&c| matches!(c, '>' | ' ')).filter(|&c| c == '>').count();
566556

567557
for _ in 0..remove_indent {
568558
line_start.pop();

0 commit comments

Comments
 (0)