From bd7bf4a276c5d49dd18f2df46694a66c4401a65e Mon Sep 17 00:00:00 2001 From: Robin van Dijk Date: Tue, 6 Oct 2020 16:34:38 +0200 Subject: add break after codeblocks --- crates/ide/src/markdown_remove.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/ide/src/markdown_remove.rs b/crates/ide/src/markdown_remove.rs index ea12cf0fc..02ad39dfb 100644 --- a/crates/ide/src/markdown_remove.rs +++ b/crates/ide/src/markdown_remove.rs @@ -1,6 +1,6 @@ //! Removes markdown from strings. -use pulldown_cmark::{Event, Parser}; +use pulldown_cmark::{Event, Parser, Tag}; /// Removes all markdown, keeping the text and code blocks /// @@ -12,7 +12,9 @@ pub fn remove_markdown(markdown: &str) -> String { for event in parser { match event { Event::Text(text) | Event::Code(text) => out.push_str(&text), - Event::SoftBreak | Event::HardBreak | Event::Rule => out.push('\n'), + Event::SoftBreak | Event::HardBreak | Event::Rule | Event::End(Tag::CodeBlock(_)) => { + out.push('\n') + } _ => {} } } -- cgit v1.2.3