aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/markdown_remove.rs
diff options
context:
space:
mode:
authorRobin van Dijk <[email protected]>2020-10-06 15:34:38 +0100
committerRobin van Dijk <[email protected]>2020-10-06 15:34:38 +0100
commitbd7bf4a276c5d49dd18f2df46694a66c4401a65e (patch)
treef47c7697d50d49cb201c672fc71b122d8672dd59 /crates/ide/src/markdown_remove.rs
parentbc890ed5b0898445c998ec62fb89188afefb61ec (diff)
add break after codeblocks
Diffstat (limited to 'crates/ide/src/markdown_remove.rs')
-rw-r--r--crates/ide/src/markdown_remove.rs6
1 files changed, 4 insertions, 2 deletions
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 @@
1//! Removes markdown from strings. 1//! Removes markdown from strings.
2 2
3use pulldown_cmark::{Event, Parser}; 3use pulldown_cmark::{Event, Parser, Tag};
4 4
5/// Removes all markdown, keeping the text and code blocks 5/// Removes all markdown, keeping the text and code blocks
6/// 6///
@@ -12,7 +12,9 @@ pub fn remove_markdown(markdown: &str) -> String {
12 for event in parser { 12 for event in parser {
13 match event { 13 match event {
14 Event::Text(text) | Event::Code(text) => out.push_str(&text), 14 Event::Text(text) | Event::Code(text) => out.push_str(&text),
15 Event::SoftBreak | Event::HardBreak | Event::Rule => out.push('\n'), 15 Event::SoftBreak | Event::HardBreak | Event::Rule | Event::End(Tag::CodeBlock(_)) => {
16 out.push('\n')
17 }
16 _ => {} 18 _ => {}
17 } 19 }
18 } 20 }