@nacho-cs/md-table
v1.0.0
Published
a lightweight package to generate tables in markdown from matrices
Readme
md-table
a lightweight package to generate tables in markdown from matrices
to add
- first install the package using npm, the add it using the ESM syntax (import)
- commonJS syntax is not supported (require)
import mdTable from "@nacho-cs/md-table";to use
import mdTable from "@nacho-cs/md-table";
const labels = ["Fruits", "Vegetables"];
const data = [
["Bananas", "Carrots"],
["Oranges", "Tomatoes"],
];
const table = mdTable(labels, data);
console.log(table);
// | Fruits | Vegetables |
// |---------|------------|
// | Bananas | Carrots |
// | Oranges | Tomatoes |- the first parameter for
mdTableis the label for the table - in this case, the labels are
FruitsandVegetables - the second parameter is for the data
- the data is a matrix that represents the actual table (
Bananas,Carrots,Oranges, andTomatoesare the data in this case)
