thp/doc-generator/src/generator/paragraph.rs

22 lines
455 B
Rust
Raw Normal View History

2023-03-30 21:19:48 +00:00
use markdown::mdast::Paragraph;
use super::Printable;
impl Printable for Paragraph {
fn to_html(&self) -> String {
let mut result = Vec::<String>::new();
for node in &self.children {
result.push(node.to_html())
}
let text: String = result.into_iter().collect();
format!("<p>{}</p>", text)
}
fn get_text(&self) -> String {
panic!("Paragraph cannot return its raw text")
}
2023-03-31 23:23:46 +00:00
}