This commit is contained in:
Noah Hellman 2022-12-10 08:37:00 +01:00
parent 60927e7298
commit 5afc6a41a8

View file

@ -163,8 +163,11 @@ impl<'s> Parser<'s> {
// trim ending whitespace of block if not verbatim
if !matches!(l, Leaf::CodeBlock { .. }) {
let last = &mut lines[line_count - 1];
*last = last.trim_end(self.src);
let l = lines.len();
if l > 0 {
let last = &mut lines[l - 1];
*last = last.trim_end(self.src);
}
}
lines
@ -728,6 +731,21 @@ mod test {
);
}
#[test]
fn block_thematic_break() {
test_block!("---\n", Block::Leaf(ThematicBreak), "---", 1);
test_block!(
concat!(
" -*- -*-\n",
"\n", //
"para", //
),
Block::Leaf(ThematicBreak),
"-*- -*-",
1
);
}
#[test]
fn block_code_block() {
test_block!(