Skip to content

fix(sections): split a section at a paragraph start when no heading matches - #78

Merged
Rl0007 merged 2 commits into
mainfrom
fix/split-at-paragraph
Oct 6, 2026
Merged

Rl0007 merged 2 commits into
mainfrom
fix/split-at-paragraph

Conversation

@Rl0007

@Rl0007 Rl0007 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor
  1. The assistant could not split a parsed section: split only looked for markdown headings, and parsed sections have none.
  2. When no heading matches, split now looks for the one paragraph that starts with the given text (case-insensitive, outer spaces ignored). If several paragraphs start that way, it refuses and says how many, so you can give more of the text.

You can ask the assistant on any import's Wiki tab to split a section at a paragraph to see it.

Fixes #35

Verification
  • Added 2 tests in test_section_surgery: split a heading-less section at a paragraph start, and refuse an ambiguous start with nothing changed. Both failed on main ("No heading matching ...") and pass now. The existing heading-split tests still pass.
  • Full suite on a devbox: 487 run, 476 pass, 11 skip, 0 fail (baseline 485 + the 2 new tests).
  • On the devbox, called the split_section tool on a real parsed section at "Each page row carries". It made two siblings with the right text, and merging them back restored the original tree and text exactly. An ambiguous start ("the ", 2 matches; "- **", 5 matches) was refused, and the section was unchanged.
  • Code review: approved. Open point: a match on the first paragraph leaves the original section empty. Headings already behave this way.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007 Rl0007 mentioned this pull request Oct 6, 2026
8 tasks
@Rl0007 Rl0007 added the Test Again Test again once the PR is merged label Oct 6, 2026
@Rl0007
Rl0007 merged commit 37eac3b into main Oct 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Test Again Test again once the PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assistant can't split a parsed section at a paragraph

1 participant