Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Convert CSV to a Markdown table

Goal: Turn a .csv file into a formatted Markdown table for documentation.

Prerequisites: None — .csv files are parsed automatically.

Query

$ mq 'csv::csv_to_markdown_table' example.csv

Input (example.csv)

Name,Age,City
Alice,30,NYC
Bob,25,LA

Output

| Name  | Age | City |
| ----- | --- | ---- |
| Alice | 30  | NYC  |
| Bob   | 25  | LA   |

Notes