block: fix empty lines in code block

were accidentaly removed
This commit is contained in:
Noah Hellman 2023-01-30 21:04:08 +01:00
parent de7404137e
commit 5672ef4198

View file

@ -257,7 +257,10 @@ impl<'s> TreeParser<'s> {
fn parse_leaf(&mut self, leaf: Leaf, k: &Kind, span: Span, lines: &mut [Span]) { fn parse_leaf(&mut self, leaf: Leaf, k: &Kind, span: Span, lines: &mut [Span]) {
if let Kind::Fenced { indent, .. } = k { if let Kind::Fenced { indent, .. } = k {
for line in lines.iter_mut() { for line in lines.iter_mut() {
let indent_line = line.len() - line.trim_start(self.src).len(); let indent_line = line.len()
- line
.trim_start_matches(self.src, |c| c != '\n' && c.is_whitespace())
.len();
*line = line.skip((*indent).min(indent_line)); *line = line.skip((*indent).min(indent_line));
} }
} else { } else {