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

View file

@ -163,9 +163,12 @@ impl<'s> Parser<'s> {
// trim ending whitespace of block if not verbatim // trim ending whitespace of block if not verbatim
if !matches!(l, Leaf::CodeBlock { .. }) { if !matches!(l, Leaf::CodeBlock { .. }) {
let last = &mut lines[line_count - 1]; let l = lines.len();
if l > 0 {
let last = &mut lines[l - 1];
*last = last.trim_end(self.src); *last = last.trim_end(self.src);
} }
}
lines lines
.iter() .iter()
@ -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] #[test]
fn block_code_block() { fn block_code_block() {
test_block!( test_block!(