From 1450070f7377910af4a80374858e3436b7e14059 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 5 Nov 2020 21:43:04 -0800 Subject: Fix stray spacing after #playground code --- src/preprocess/links.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/preprocess/links.rs b/src/preprocess/links.rs index 8cd95824..0e2eefbc 100644 --- a/src/preprocess/links.rs +++ b/src/preprocess/links.rs @@ -335,7 +335,7 @@ impl<'a> Link<'a> { LinkType::Playground(ref pat, ref attrs) => { let target = base.join(pat); - let contents = fs::read_to_string(&target).with_context(|| { + let mut contents = fs::read_to_string(&target).with_context(|| { format!( "Could not read file for link {} ({})", self.link_text, @@ -343,8 +343,11 @@ impl<'a> Link<'a> { ) })?; let ftype = if !attrs.is_empty() { "rust," } else { "rust" }; + if !contents.ends_with('\n') { + contents.push('\n'); + } Ok(format!( - "```{}{}\n{}\n```\n", + "```{}{}\n{}```\n", ftype, attrs.join(","), contents -- cgit v1.2.3