Skip to content

fix: keep comment anchors within Markdown block content - #6

Open
petergaultney wants to merge 1 commit into
No-Instructions:mainfrom
petergaultney:relay-comments/block-prefix-fix
Open

petergaultney wants to merge 1 commit into
No-Instructions:mainfrom
petergaultney:relay-comments/block-prefix-fix

Conversation

@petergaultney

@petergaultney petergaultney commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🍋:

Comment anchors can still include Markdown structure when a selection crosses into another block or when selected text changes while the draft is open. This extends the existing prefix narrowing: comments keep closing heading hashes and selected line breaks outside their markup, and saving validates the current mapped range again. Prefixes remain selectable.

  • Refuse selections that cross into a later prefixed line, including selections starting in ordinary prose or ending within a later prefix.
  • Refuse prefixed selections spanning multiple source lines, including continuation lines within a list item. The README documents that limitation.
  • Support nested lists with tabs or spaces using the shared structuralPrefixLength parser, including combined quote/list containers. Keep indentation outside the mark without trying to infer whether a line is code or list content. Use a clearer notice when a pending draft's text becomes unsafe to wrap.
  • Preserve the existing native-highlight and overlap checks. The source-based helper adds no parser dependency and does not replace the existing selection behavior.

Validation: 140 focused tests across five suites, TypeScript check, lint, no-node check, production build, and whitespace checks passed on this upstream-based branch. Coverage includes ordered/unordered lists, tasks, headings, blockquotes, LF/CRLF, selection direction, native highlights, mapped edits, cross-block ranges, and nested list/quote and code-text contexts.

Diff breakdown

Category Files +Lines -Lines Net Total % of diff
code 5 +269 -17 +252 286 97.9%
docs 1 +6 -0 +6 6 2.1%

@petergaultney
petergaultney force-pushed the relay-comments/block-prefix-fix branch from a6bc80d to e3f7afe Compare October 14, 2026 17:28
@petergaultney
petergaultney marked this pull request as ready for review October 14, 2026 17:39
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.

1 participant