Skip to content

fix(kirari): end Markdown headings before the line break - #13

Merged
ugi-dev merged 1 commit into
mainfrom
refactor/scanner
Oct 22, 2026
Merged

ugi-dev merged 1 commit into
mainfrom
refactor/scanner

Conversation

@ugi-dev

@ugi-dev ugi-dev commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

What and why

Markdown heading tokens included the trailing line break: # Title\nnext produced "# Title\n":heading. No other token ends with a newline, so line-based renderers had to split the heading, and a background or decoration on .kirari-heading ran past the end of the line.

ATX (# Title) and setext (Title / =====) headings now end at the end of the line, and the line break (\n, \r\n, or \r) is a separate text token:

"# Title":heading  "\n":text  "next":text

This applies to the markdown language and to createMarkdown, which uses the same tokenizer outside fences. No public API change.

Stacked on #12.

Closes #6

Validation

  • bun run check passes.
  • Updated heading expectations in common-formats.test.ts and markdown-fences.test.ts, plus new cases for the issue input and CRLF setext headings.
  • Bundle sizes: core and JavaScript unchanged (3,735 and 4,252 bytes gzip); all languages +12 bytes gzip.

Checklist

  • bun run check passes
  • Tests cover the change
  • Changeset added (bunx changeset), or not needed for docs, tests, or internal changes
  • Docs updated if behavior or APIs changed

Summary by CodeRabbit

  • Bug Fixes
    • Markdown heading tokens now end at the heading text. Trailing line breaks are handled separately, improving heading styling and line-based rendering across hash-style and underline-style headings.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

  • Run on-demand review

This review includes 5 billable files and costs up to $1.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 29 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 5 included reviews currently available. Your 12 included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository YAML (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: abec603c-2b5d-493f-9ced-8d207e57b5e8
📥 Commits

Reviewing files that changed from the base of the PR and between 7ebe2af and cfa00b7.

📒 Files selected for processing: 5
  • .changeset/fix-markdown-heading-newline.md
  • packages/kirari/src/languages/markdown.ts
  • packages/kirari/test/common-formats.test.ts
  • packages/kirari/test/markdown-fences.test.ts
  • sites/docs/changelog/kirari/1.1.3.md

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository YAML (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 762f92e9-4d7d-4c35-b2ff-7baa7a69440d
📥 Commits

Reviewing files that changed from the base of the PR and between 4a72eb1 and 7ebe2af.

📒 Files selected for processing: 5
  • .changeset/fix-markdown-heading-newline.md
  • packages/kirari/src/languages/markdown.ts
  • packages/kirari/test/common-formats.test.ts
  • packages/kirari/test/markdown-fences.test.ts
  • sites/docs/changelog/kirari/1.1.3.md

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Walkthrough

Markdown heading tokens now end before their trailing line breaks. The line breaks are emitted as separate text tokens for ATX and Setext headings.

Changes

Markdown heading tokens

Layer / File(s) Summary
Separate heading content from line breaks
packages/kirari/src/languages/markdown.ts, packages/kirari/test/common-formats.test.ts, packages/kirari/test/markdown-fences.test.ts, .changeset/fix-markdown-heading-newline.md, sites/docs/changelog/kirari/1.1.3.md
A shared helper emits heading content and its trailing line break as separate tokens. ATX and Setext headings use the helper. Tests cover LF and CRLF line endings and heading contexts. The changeset and changelog describe the update.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 7ebe2

The change separates heading tokens from line endings and updates the relevant tests. I see no material issue preventing merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: Markdown heading tokens now end before the line break.
Linked Issues check Passed Issue #6 requires Markdown heading tokens to exclude the following line break and to emit that break as text. packages/kirari/src/languages/markdown.ts implements this for ATX and setext headings.…
Out of Scope Changes check Passed The changes stay within Issue #6. The source change fixes heading boundaries. The test changes verify the new token stream and preserve fence behavior. The changeset and changelog document the same Ma…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Full details: Linked Issues check

Explanation

Issue #6 requires Markdown heading tokens to exclude the following line break and to emit that break as text. packages/kirari/src/languages/markdown.ts implements this for ATX and setext headings. The tests cover the required # Title\nnext result, CRLF input, setext headings, and Markdown fences. The reported createMarkdown behavior is also covered by markdown-fences.test.ts.

Full details: Out of Scope Changes check

Explanation

The changes stay within Issue #6. The source change fixes heading boundaries. The test changes verify the new token stream and preserve fence behavior. The changeset and changelog document the same Markdown behavior. No unrelated public API or feature changes are shown.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T05:23:11.483943Z 7ebe2af Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ugi-dev
ugi-dev added this pull request to stack #15 October 22, 2026 05:01
@ugi-dev ugi-dev closed this Oct 22, 2026
@ugi-dev
ugi-dev deleted the refactor/scanner branch October 22, 2026 05:03
@ugi-dev
ugi-dev restored the refactor/scanner branch October 22, 2026 05:06
@ugi-dev ugi-dev reopened this Oct 22, 2026
@ugi-dev
ugi-dev force-pushed the refactor/scanner branch 2 times, most recently from 2dc5ca0 to 2990773 Compare October 22, 2026 05:16
@ugi-dev ugi-dev changed the title refactor(kirari): split scanner, markup, and stream into named steps fix(kirari): end Markdown headings before the line break Oct 22, 2026
@ugi-dev ugi-dev mentioned this pull request Oct 22, 2026
4 tasks done
@ugi-dev

ugi-dev commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@ugi-dev

ugi-dev commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 7ebe2af7b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Base automatically changed from refactor/function-syntax to main October 22, 2026 05:29
ATX and setext heading tokens stop at the end of the line; the line break is emitted as text. Line-based renderers no longer need to split heading tokens, and heading styles stop at the line end.

Closes #6
@ugi-dev
ugi-dev merged commit fedb9d8 into main Oct 22, 2026
5 checks passed
@ugi-dev
ugi-dev deleted the refactor/scanner branch October 22, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown heading token includes the trailing newline

1 participant