#markdown-tables #data-structures #table-row #format

to_markdown_table

An easy way to format any data structure into a Markdown table

5 releases

0.1.5 Oct 6, 2024
0.1.4 Oct 5, 2024
0.1.3 Oct 5, 2024
0.1.2 Oct 5, 2024
0.1.1 Apr 1, 2024

#699 in Text processing

Download history 1793/week @ 2025-03-22 2801/week @ 2025-03-29 2303/week @ 2025-04-05 2440/week @ 2025-04-12 2408/week @ 2025-04-19 2145/week @ 2025-04-26 2269/week @ 2025-05-03 2061/week @ 2025-05-10 2420/week @ 2025-05-17 2946/week @ 2025-05-24 2440/week @ 2025-05-31 3086/week @ 2025-06-07 2590/week @ 2025-06-14 2878/week @ 2025-06-21 2037/week @ 2025-06-28 2042/week @ 2025-07-05

10,144 downloads per month
Used in cargo-depcription

MIT license

9KB
186 lines

A simple library to create markdown tables.

Example

use to_markdown_table::{MarkdownTable, TableRow};

struct User {
    name: String,
    age: u32
}

impl Into<TableRow> for User {
    fn into(self) -> TableRow {
        TableRow::new(vec![self.name.clone(), self.age.to_string()])
    }
}

let rows = vec![
    User { name: "Jessica".to_string(), age: 28 },
    User { name: "Dennis".to_string(), age: 22 }
];

let table = MarkdownTable::new(Some(vec!["Name".to_string(), "Age".to_string()]), rows).unwrap();

println!("{}", table);

to_markdown_table

An easy way to format any data structure into a Markdown table.

[dependencies]
to_markdown_table = "0.1.0"

Example

use to_markdown_table::{MarkdownTable, TableRow};

struct User {
    name: String,
    age: u32
}

impl Into<TableRow> for User {
    fn into(self) -> TableRow {
        TableRow::new(vec![self.name.clone(), self.age.to_string()])
    }
}

let rows = vec![
    User { name: "Jessica".to_string(), age: 28 },
    User { name: "Dennis".to_string(), age: 22 }
];

let table = MarkdownTable::new(vec!["Name".to_string(), "Age".to_string()], rows).unwrap();

println!("{}", table);

Dependencies

~200–630KB
~15K SLoC