#markdown-tables #table #structure

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

#439 in Data structures

Download history 727/week @ 2024-11-20 1014/week @ 2024-11-27 1202/week @ 2024-12-04 1622/week @ 2024-12-11 978/week @ 2024-12-18 988/week @ 2024-12-25 1486/week @ 2025-01-01 2410/week @ 2025-01-08 1238/week @ 2025-01-15 1755/week @ 2025-01-22 1366/week @ 2025-01-29 1284/week @ 2025-02-05 1577/week @ 2025-02-12 1812/week @ 2025-02-19 1821/week @ 2025-02-26 1559/week @ 2025-03-05

7,126 downloads per month

MIT license

9KB
186 lines

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);

lib.rs:

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);

Dependencies

~230–680KB
~16K SLoC