markdown_table
Description
markdown_table turns a list of data points into a table in the markdown format, that can be rendered on documents or in the case.
markdown_table takes either
a list of dictionaries, where the keys of the first dictionary represent the columns and the values of each dictionary are the rows of the table or
a list of lists where the values in each list are the rows and a second argument of a list of keys to use as columns of the table
Example with list and header
header := ['Last Name', 'First Name']
data := [['Croisé', 'Thorben'], ['Zivic', 'Tijana'], ['Balzer', 'Alexander']]
markdown_table(data, header)This outputs a markdown table with the columns Last Name and First Name and the rows of the names of the Thorben, Tijana and Alexander:
| Last Name | First Name |
| --------- | ---------- |
| Croisé | Thorben |
| Zivic | Tijana |
| Balzer | Alexander |Example with dictionaries
Will output the same table as the first example.
Example with alignment options
Outputs a list where the first column is left aligned and the column with the key Animal is right aligned:
Last updated
Was this helpful?
