mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-14 23:02:34 +00:00
Merge pull request #1375 from dtolnay/playground
Fix stray spacing after #playground code
This commit is contained in:
commit
58f66a146d
1 changed files with 5 additions and 2 deletions
|
@ -335,7 +335,7 @@ impl<'a> Link<'a> {
|
||||||
LinkType::Playground(ref pat, ref attrs) => {
|
LinkType::Playground(ref pat, ref attrs) => {
|
||||||
let target = base.join(pat);
|
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!(
|
format!(
|
||||||
"Could not read file for link {} ({})",
|
"Could not read file for link {} ({})",
|
||||||
self.link_text,
|
self.link_text,
|
||||||
|
@ -343,8 +343,11 @@ impl<'a> Link<'a> {
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
let ftype = if !attrs.is_empty() { "rust," } else { "rust" };
|
let ftype = if !attrs.is_empty() { "rust," } else { "rust" };
|
||||||
|
if !contents.ends_with('\n') {
|
||||||
|
contents.push('\n');
|
||||||
|
}
|
||||||
Ok(format!(
|
Ok(format!(
|
||||||
"```{}{}\n{}\n```\n",
|
"```{}{}\n{}```\n",
|
||||||
ftype,
|
ftype,
|
||||||
attrs.join(","),
|
attrs.join(","),
|
||||||
contents
|
contents
|
||||||
|
|
Loading…
Reference in a new issue