markdown_fmt/
html_block.rs

1use super::*;
2
3/// A buffer where we write HTML blocks. Preserves everything as is.
4pub struct PreservingHtmlBlock {
5    buffer: String,
6}
7
8impl Write for PreservingHtmlBlock {
9    fn write_str(&mut self, s: &str) -> std::fmt::Result {
10        self.buffer.push_str(s);
11        Ok(())
12    }
13}
14
15impl ParagraphFormatter for PreservingHtmlBlock {
16    fn new(_max_width: Option<usize>, capacity: usize) -> Self {
17        Self {
18            buffer: String::with_capacity(capacity),
19        }
20    }
21
22    fn is_empty(&self) -> bool {
23        self.buffer.is_empty()
24    }
25
26    fn into_buffer(self) -> String {
27        self.buffer
28    }
29}