Skip to content

Commit bd7bf4a

Browse files
committed
add break after codeblocks
1 parent bc890ed commit bd7bf4a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/ide/src/markdown_remove.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Removes markdown from strings.
22
3-
use pulldown_cmark::{Event, Parser};
3+
use pulldown_cmark::{Event, Parser, Tag};
44

55
/// Removes all markdown, keeping the text and code blocks
66
///
@@ -12,7 +12,9 @@ pub fn remove_markdown(markdown: &str) -> String {
1212
for event in parser {
1313
match event {
1414
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+
}
1618
_ => {}
1719
}
1820
}

0 commit comments

Comments
 (0)