Markdown table
Turn structured data into a Markdown table with one command.
Use it
-
Identify the input file (
.json,.csv,.tsv) and, for JSON, the shape: a list of objects, or a single object whose values are lists. -
Run the helper script:
python scripts/to_md_table.py <file> [--json-path KEY] [--max-rows N]--json-pathselects a nested key inside a JSON document (dot-separated, e.g.data.items).--max-rowstruncates the output and appends a note row.
-
Paste the printed table into the answer, or write it to a
.mdfile with>redirection when the user wants a file.
Behavior
- Columns are the union of keys across all rows, in first-seen order.
- Missing keys render as empty cells;
Nonerenders asnull. - Cell text is escaped:
|becomes\|, and newlines become<br>. - If the file has no tabular rows, say so instead of printing an empty table.
Requirements
Python 3.8+, standard library only. No network access and no other packages.
<!-- OB-S:tsUqhUNsDPPG-gFTacA-qQ -->
微信扫一扫