#markdown-tables #table #structure #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

#436 in Data structures

Download history 327/week @ 2024-11-15 925/week @ 2024-11-22 899/week @ 2024-11-29 1200/week @ 2024-12-06 1763/week @ 2024-12-13 602/week @ 2024-12-20 1230/week @ 2024-12-27 1957/week @ 2025-01-03 2140/week @ 2025-01-10 1166/week @ 2025-01-17 1679/week @ 2025-01-24 1398/week @ 2025-01-31 1014/week @ 2025-02-07

5,473 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

~220–660KB
~16K SLoC