diff --git a/src/utils/highlight.rs b/src/utils/highlight.rs index 8325a5eb..ddc839cf 100644 --- a/src/utils/highlight.rs +++ b/src/utils/highlight.rs @@ -125,7 +125,6 @@ fn boringify(line: &str) -> (String, bool) { } } result += line; - result += "\n"; (result, false) } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 45413f36..917145cf 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -575,11 +575,8 @@ more text with spaces let expected = r#"

some text with spaces

fn main() {
-
 // code inside is unchanged
-
-}
-
+}
 

more text with spaces

"#; @@ -703,19 +700,19 @@ more text with spaces fn add_playground() { let inputs = [ ("```rust\nx()\n```", - "
fn main() {\nx()\n\n}\n
"), + "
fn main() {\nx()\n}\n
"), ("```rust\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ("```rust editable\nlet s = \"foo\n # bar\n\";\n```", - "
let s = "foo\n\n bar\n";\n\n
"), + "
let s = "foo\n bar\n";\n
"), ("```rust editable\nlet s = \"foo\n ## bar\n\";\n```", - "
let s = "foo\n\n # bar\n";\n\n
"), + "
let s = "foo\n # bar\n";\n
"), ("```rust editable\nlet s = \"foo\n # bar\n#\n\";\n```", - "
let s = "foo\n\n bar\n\n";\n\n
"), + "
let s = "foo\n bar\n\n";\n
"), ("```rust ignore\nlet s = \"foo\n # bar\n\";\n```", - "
fn main() {\nlet s = "foo\n\n bar\n";\n\n}\n
"), + "
fn main() {\nlet s = "foo\n bar\n";\n}\n
"), ("```rust editable\n#![no_std]\nlet s = \"foo\";\n #[some_attr]\n```", - "
#![no_std]\n\nlet s = "foo";\n\n #[some_attr]\n\n
"), + "
#![no_std]\nlet s = "foo";\n #[some_attr]\n
"), ]; for (src, should_be) in &inputs { let got = render_markdown( @@ -735,13 +732,13 @@ more text with spaces fn add_playground_edition2015() { let inputs = [ ("```rust\nx()\n```", - "
fn main() {\nx()\n\n}\n
"), + "
fn main() {\nx()\n}\n
"), ("```rust\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ("```rust edition2015\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ("```rust edition2018\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ]; for (src, should_be) in &inputs { let got = render_markdown( @@ -761,13 +758,13 @@ more text with spaces fn add_playground_edition2018() { let inputs = [ ("```rust\nx()\n```", - "
fn main() {\nx()\n\n}\n
"), + "
fn main() {\nx()\n}\n
"), ("```rust\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ("```rust edition2015\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ("```rust edition2018\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ]; for (src, should_be) in &inputs { let got = render_markdown( @@ -787,13 +784,13 @@ more text with spaces fn add_playground_edition2021() { let inputs = [ ("```rust\nx()\n```", - "
fn main() {\nx()\n\n}\n
"), + "
fn main() {\nx()\n}\n
"), ("```rust\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ("```rust edition2015\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ("```rust edition2018\nfn main() {}\n```", - "
fn main() {}\n\n
"), + "
fn main() {}\n
"), ]; for (src, should_be) in &inputs { let got = render_markdown(