Strip last backline from non-rust code examples

This commit is contained in:
Guillaume Gomez 2024-09-21 15:58:18 +02:00
parent da889684c8
commit 7c35266552
2 changed files with 5 additions and 5 deletions

View File

@ -261,7 +261,9 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
</pre>\ </pre>\
</div>", </div>",
added_classes = added_classes.join(" "), added_classes = added_classes.join(" "),
text = Escape(&original_text), text = Escape(
original_text.strip_suffix('\n').unwrap_or(&original_text)
),
) )
.into(), .into(),
)); ));

View File

@ -524,15 +524,13 @@ fn test_ascii_with_prepending_hashtag() {
####.###..#....#....#..#. ####.###..#....#....#..#.
#..#.#....#....#....#..#. #..#.#....#....#....#..#.
#..#.#....#....#....#..#. #..#.#....#....#....#..#.
#..#.####.####.####..##.. #..#.####.####.####..##..</code></pre></div>",
</code></pre></div>",
); );
t( t(
r#"```markdown r#"```markdown
# hello # hello
```"#, ```"#,
"<div class=\"example-wrap\"><pre class=\"language-markdown\"><code>\ "<div class=\"example-wrap\"><pre class=\"language-markdown\"><code>\
# hello # hello</code></pre></div>",
</code></pre></div>",
); );
} }