Skip to content

Commit

Permalink
preserve newlines in weird text blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
msrd0 committed May 13, 2024
1 parent 6373d7f commit 8be400f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,16 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for EventFilter<'a, I> {
}),

Event::Text(text) if self.in_code_block => {
let filtered = text
let mut filtered = text
.lines()
.filter(|line| !is_hidden_codeblock_line(line))
.join("\n");
if filtered.is_empty() {
continue;
}
if text.ends_with('\n') {
filtered.push('\n');
}
Event::Text(filtered.into())
},

Expand Down

0 comments on commit 8be400f

Please sign in to comment.