diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-09-18 10:46:12 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-09-18 10:46:12 +0100 |
commit | 59311238193b0b0b4cdd7d0e90db6c1804a19521 (patch) | |
tree | d2ef8d9903f399ff26e2ee7bc52401b62f3471e2 | |
parent | 85e1d8fe7e0b2a6e020ec1d1319b3759c5ae0c2d (diff) | |
download | subplot-59311238193b0b0b4cdd7d0e90db6c1804a19521.tar.gz |
ast: Codeblocks should not have extra trailing newlines
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r-- | src/ast.rs | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -188,6 +188,12 @@ fn code_block(kind: &CodeBlockKind, inlines: &mut Vec<Inline>) -> Block { let text = plain_text_inline(inline); code.push_str(&text); } + // pulldown_cmark and pandoc differ in their codeblock handling, + // pulldown_cmark has an extra newline which we trim for now to be + // compatible with pandoc's parsing + if !code.is_empty() { + assert_eq!(code.pop(), Some('\n')); + } Block::CodeBlock(attr, code) } |