feat(mdformat): add markdown table formatter tool and tasks#442
feat(mdformat): add markdown table formatter tool and tasks#442ajalon1 wants to merge 11 commits into
Conversation
Add a new Go-based markdown table formatter tool using the fbiville/markdown-table-formatter library. The tool formats markdown tables to be readable in raw form by aligning columns with padding. New additions: - tools/mdformat/: Standalone Go tool that parses and formats markdown tables - format-md-tables task: Manually format markdown tables - lint task: Now checks markdown tables (with -check flag) - delint task: Now formats markdown tables as first step The tool recursively formats all .md files while skipping .factory and node_modules directories. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Trivy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
ef3d160 to
00c3fb8
Compare
| func isTableLine(line string) bool { | ||
| trimmed := strings.TrimSpace(line) | ||
| return strings.Contains(trimmed, "|") | ||
| } |
There was a problem hiding this comment.
Table detection matches any line containing pipe character
High Severity
isTableLine returns true for any line containing a | character, and formatMarkdown has no awareness of fenced code blocks. Lines inside code blocks with shell pipes (e.g., cmd | tee file), bitwise OR expressions, or other non-table uses of | get collected and potentially reformatted as table content. When two or more consecutive pipe-containing lines appear inside a code block, they'll be passed to formatTable and corrupted.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 00c3fb8. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
There are 3 total unresolved issues (including 1 from previous review).
Reviewed by Cursor Bugbot for commit 2c5ff0b. Configure here.
| silent: true | ||
| desc: "Format markdown tables" | ||
| cmds: | ||
| - sh -c 'cd tools/mdformat && go run . ../../..' |
There was a problem hiding this comment.
Wrong path traverses above repository root directory
High Severity
The format-md-tables task uses ../../.. as the target path, but from tools/mdformat/ that navigates three levels up — to the parent of the repository root. It needs ../.. (two levels) to reach the repo root. The lint task correctly targets . from the repo root, but format-md-tables (also called by delint) will recursively walk and rewrite .md files outside the repository.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2c5ff0b. Configure here.
| return processFile(filePath, checkMode) | ||
| } | ||
| return nil | ||
| }) |
There was a problem hiding this comment.
Check mode stops after first unformatted file found
Medium Severity
In check mode, processFile returns an error for each file needing formatting. Since filepath.Walk stops on the first non-nil error from its callback, the directory walk aborts after discovering just one unformatted file. The lint task (mdformat -check .) will therefore only report a single file per run, requiring repeated runs to find all issues. The callback needs to accumulate failures without stopping the walk.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2c5ff0b. Configure here.


Add a new Go-based markdown table formatter tool using the fbiville/markdown-table-formatter library.
The tool formats markdown tables to be readable in raw form by aligning columns with padding.
What's new
Implementation details
Testing
Note
Low Risk
Primarily tooling and documentation formatting changes; main risk is introducing new lint/format enforcement that could fail CI or rewrite markdown unexpectedly.
Overview
Introduces a new Go tool,
tools/mdformat, that scans Markdown files and rewrites table blocks with aligned columns (or fails in-checkmode).Wires this into developer workflows by adding a
task format-md-tables, runningmdformat -check .as the first step oftask lint, and formatting tables duringtask delint. Updates Go module metadata (new dependency + localtool/replace) and adjusts docs tables accordingly; licensing config now ignoresgo.mod/go.sumfiles.Reviewed by Cursor Bugbot for commit 2c5ff0b. Bugbot is set up for automated code reviews on this repo. Configure here.