From 1d46a52c62f3005abdc4da3481ef3b12ca7f1eea Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 30 May 2024 16:38:01 -0400 Subject: [PATCH] rustdoc_to_markdown: Don't push blank space after newline (#12504) This PR fixes a small issue in `rustdoc_to_markdown` where we could push a blank space after a newline, leading to an unwanted leading space. Release Notes: - N/A --- crates/rustdoc_to_markdown/src/markdown_writer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rustdoc_to_markdown/src/markdown_writer.rs b/crates/rustdoc_to_markdown/src/markdown_writer.rs index 2d749110720aa522d566643545f180a371b16c1c..bafac18a33e6feed4b4ba8cf343f971194e453c8 100644 --- a/crates/rustdoc_to_markdown/src/markdown_writer.rs +++ b/crates/rustdoc_to_markdown/src/markdown_writer.rs @@ -134,7 +134,7 @@ impl MarkdownWriter { if tag.is_inline() && self.is_inside("p") { if let Some(parent) = self.current_element_stack.iter().last() { if !parent.is_inline() { - if !self.markdown.ends_with(' ') { + if !(self.markdown.ends_with(' ') || self.markdown.ends_with('\n')) { self.push_str(" "); } }