reactive_graph_generator_documentation/markdown/
table.rs1use markdown_builder::Markdown;
2use markdown_builder::MarkdownElement;
3use tabled::Table;
4use tabled::settings::Style;
5
6#[derive(Clone, Debug)]
7pub struct MarkdownTable(pub Table);
8
9impl MarkdownElement for MarkdownTable {
10 fn render(&self) -> String {
11 format!("{}\n", self.0.to_string())
12 }
13}
14
15pub trait MarkdownTableExt {
16 fn table(&mut self, table: Table) -> &mut Self;
17}
18
19impl MarkdownTableExt for Markdown {
20 fn table(&mut self, mut table: Table) -> &mut Self {
21 let table = table.with(Style::markdown());
22 self.elements.push(Box::new(MarkdownTable(table.to_owned())));
23 self
24 }
25}