fix: ledger files pass markdownlint MD012 #101

Merged
joshtronic merged 1 commit from fix/ledger-markdownlint into master 2026-05-22 20:46:53 +00:00
Owner

The ledger template ended with "## Index\n\n" -- a trailing blank
line that markdownlint MD012 (no-multiple-blanks) flagged on
every newly-created ledger, breaking brain's npm test. The
heading-to-list spacing for MD022 was the original intent, but
applying it eagerly meant an empty ledger had two consecutive
blanks at EOF.

Three changes:

  1. ledger_init's heredoc no longer trails a blank line. Empty
    ledgers end at "## Index\n" -- one newline, clean EOF.

  2. ledger_append_urls detects "this is the first URL" and inserts
    a blank-line separator before it. Once URLs are present, the
    list is correctly separated from the heading (MD022 happy);
    when no URLs exist, no trailing blank (MD012 happy).

  3. ledger_strip_trailing_blanks helper added, called from
    ledger_init whenever the file already exists. Existing broken
    ledgers (the three created by today's earlier ticks) auto-heal
    on the next discretionary-read invocation -- the next
    commit_brain_changes picks up the normalization, brain CI
    passes after that.

Verified end-to-end:

  • Empty fresh ledger -> markdownlint exit 0
  • Populated ledger (URLs appended) -> markdownlint exit 0
  • Existing broken ledger run through the strip -> markdownlint
    exit 0 (file shrinks from 7 lines ending in \n\n to 6 lines
    ending in \n)

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

The ledger template ended with "## Index\n\n" -- a trailing blank line that markdownlint MD012 (no-multiple-blanks) flagged on every newly-created ledger, breaking brain's `npm test`. The heading-to-list spacing for MD022 was the original intent, but applying it eagerly meant an empty ledger had two consecutive blanks at EOF. Three changes: 1. ledger_init's heredoc no longer trails a blank line. Empty ledgers end at "## Index\n" -- one newline, clean EOF. 2. ledger_append_urls detects "this is the first URL" and inserts a blank-line separator before it. Once URLs are present, the list is correctly separated from the heading (MD022 happy); when no URLs exist, no trailing blank (MD012 happy). 3. ledger_strip_trailing_blanks helper added, called from ledger_init whenever the file already exists. Existing broken ledgers (the three created by today's earlier ticks) auto-heal on the next discretionary-read invocation -- the next commit_brain_changes picks up the normalization, brain CI passes after that. Verified end-to-end: - Empty fresh ledger -> markdownlint exit 0 - Populated ledger (URLs appended) -> markdownlint exit 0 - Existing broken ledger run through the strip -> markdownlint exit 0 (file shrinks from 7 lines ending in \n\n to 6 lines ending in \n) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
fix: ledger files pass markdownlint MD012
All checks were successful
Lint / check-sync (push) Successful in 10s
Lint / check-sync (pull_request) Successful in 4s
aeb72edc93
The ledger template ended with "## Index\n\n" -- a trailing blank
line that markdownlint MD012 (no-multiple-blanks) flagged on
every newly-created ledger, breaking brain's `npm test`. The
heading-to-list spacing for MD022 was the original intent, but
applying it eagerly meant an empty ledger had two consecutive
blanks at EOF.

Three changes:

1. ledger_init's heredoc no longer trails a blank line. Empty
   ledgers end at "## Index\n" -- one newline, clean EOF.

2. ledger_append_urls detects "this is the first URL" and inserts
   a blank-line separator before it. Once URLs are present, the
   list is correctly separated from the heading (MD022 happy);
   when no URLs exist, no trailing blank (MD012 happy).

3. ledger_strip_trailing_blanks helper added, called from
   ledger_init whenever the file already exists. Existing broken
   ledgers (the three created by today's earlier ticks) auto-heal
   on the next discretionary-read invocation -- the next
   commit_brain_changes picks up the normalization, brain CI
   passes after that.

Verified end-to-end:
  - Empty fresh ledger -> markdownlint exit 0
  - Populated ledger (URLs appended) -> markdownlint exit 0
  - Existing broken ledger run through the strip -> markdownlint
    exit 0 (file shrinks from 7 lines ending in \n\n to 6 lines
    ending in \n)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
joshtronic scheduled this pull request to auto merge when all checks succeed 2026-05-22 20:46:40 +00:00
joshtronic deleted branch fix/ledger-markdownlint 2026-05-22 20:46:53 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
joshtronic/igor!101
No description provided.