Files
pad/cmd
David Barkhausen f900b0aefb fix(cli): address review on markdown list output
All three requested changes from @xarmian's review of #1070, plus both nits.

1. Escape backslashes before pipes in escapeMarkdownCell. A title containing
   "\|" became "\|", which GFM reads as an escaped backslash followed by a LIVE
   pipe, so the row still gained a column. Backslash-first turns it into "\\|".
   Confirmed the bug with a failing test before fixing it.

2. Sanitize the group headings. Extracted SanitizeMarkdownText (SGR strip +
   newline collapse) and ran the collection icon and name through it, so a
   newline in a collection name can no longer inject a second "## " heading.
   Sanitizing happens per part, before joining, because it trims and would
   otherwise eat the separating space. Pipes are deliberately not escaped
   outside a table.

3. Tightened the --format help to the precise enumeration:
   "markdown on: item list/starred, collection list, item show, project changelog"
   per option (a) on #898.

Nits:
- `item starred --format markdown` on an empty result now says "No starred
  items." rather than the shared renderer's "No items found."; the empty check
  moved above the format branch so both paths agree.
- Added format_markdown_routing_test.go: three end-to-end tests driving
  `item list` and `collection list` through cobra against an httptest server,
  asserting the markdown branch is actually reached and that the table and
  markdown paths don't leak into each other. Proven by disabling the markdown
  branch and watching the test fail. Follows the item_open_test.go pattern, with
  USERPROFILE set alongside HOME since os.UserHomeDir reads USERPROFILE on
  Windows — worth noting, as tests that set only HOME are why part of the
  credential-store suite fails there.

Gates: go build ./... PASS; go vet PASS; gofmt clean; golangci-lint 0 issues;
all markdown tests PASS. Both touched packages show the same 6+2 pre-existing
Windows failures as clean main under an identical sandboxed run.
2026-08-10 13:39:06 -04:00
..