Skip to content

feat: add Markdown table output format (-O markdown)#179

Merged
vmvarela merged 1 commit into
masterfrom
feat/markdown-output-format
Jun 18, 2026
Merged

feat: add Markdown table output format (-O markdown)#179
vmvarela merged 1 commit into
masterfrom
feat/markdown-output-format

Conversation

@vmvarela

Copy link
Copy Markdown
Owner

Summary

Adds markdown (alias md) as a new output format for rendering SQL query results as GitHub-Flavored Markdown tables.

sql-pipe data.csv -O markdown 'SELECT region, SUM(amount) FROM t GROUP BY region'
# | region | SUM(amount) |
# | ------ | ----------- |
# | East   |         250 |
# | West   |         250 |

Changes

  • src/format.zig — added markdown to OutputFormat enum, md alias in parse()
  • src/markdown.zig — new two-pass writer (width computation + numeric detection, then aligned output)
  • src/main.zig — markdown dispatch in execQuery()
  • src/args.zig — help text updated
  • build.zig — 6 integration tests (basic output, md alias, numeric alignment, NULL handling, aggregation, empty result)
  • docs/sql-pipe.1.scd — man page updated with markdown option + example
  • README.md — flags table updated

Acceptance Criteria

  • Add markdown to the OutputFormat enum in src/format.zig
  • Implement markdown table writer with proper pipe-delimited rows and header separator
  • Left-align text columns, right-align numeric columns (reuse numeric detection)
  • NULL values render as empty cells (not the string "NULL")
  • -O md works as a shorthand alias
  • Compatible with --header (always include header for markdown)
  • Integration tests cover the new format
  • Help text updated

Closes #167

- Add 'markdown' to OutputFormat enum with 'md' alias
- Implement two-pass markdown writer in src/markdown.zig
- Left-align text columns, right-align numeric columns
- NULL values render as empty cells
- Add 6 integration tests covering basic output, alias, alignment, NULL handling
- Update help text, man page, and README

Closes #167
@github-actions github-actions Bot added the type:feature New functionality label Jun 18, 2026
@vmvarela vmvarela merged commit a06b4cb into master Jun 18, 2026
5 checks passed
@vmvarela vmvarela deleted the feat/markdown-output-format branch June 18, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Markdown table output format (-O markdown)

1 participant