Skip to content

fix(docs): preserve heading and anchor fidelity - #16

Merged
matcra587 merged 3 commits into
mc/docs-reference-scopefrom
mc/docs-heading-fidelity
Sep 22, 2026
Merged

matcra587 merged 3 commits into
mc/docs-reference-scopefrom
mc/docs-heading-fidelity

Conversation

@matcra587

@matcra587 matcra587 commented Sep 21, 2026 •

Copy link
Copy Markdown
Owner

Description

Heading lookup could miss published anchors or mistake code inside fences for a section. Share source-range heading parsing between extraction and section search, preserve literal source bytes and resolve exact anchors, including duplicate suffixes, inline markup, autolinks and Unicode text. List-contained fences retain their boundaries.

Review Focus

  • headings.go and extract.go: heading ranges, visible text and exact anchor selection.
  • fence.go: fence characters, lengths and list indentation; focused tests cover false headings and container termination.
  • cursor.go: reject older cursor positions after section-selection semantics change.

Test Procedure

  • mise run ci: formatting, lint, offline race tests, vulnerability checks, release checks and all five compilation targets.
  • Named regression assertions first failed for duplicate, punctuation, inline-link and autolink anchors, fence lengths and list-contained fences; all pass after the fixes.
  • Race-enabled live stdio MCP canary across all nine languages; 30-second FuzzExtractHeading run.

Pre-flight Checklist

  • Changes are limited to a single feature, bugfix or chore
  • Tests pass and code is formatted/linted
  • Docs updated (if needed)

Additional Notes

Cursor format is now v3. Clients holding earlier cursors must restart their original selection. Existing initial calls and byte offsets remain supported. Parsing remains bounded rather than implementing a general Markdown renderer.

@matcra587
matcra587 added this pull request to stack #18 September 21, 2026 23:55
@matcra587 matcra587 added the bug Something isn't working label Sep 21, 2026
@matcra587 matcra587 self-assigned this Sep 21, 2026
@matcra587 matcra587 changed the title mc/docs heading fidelity fix(docs): preserve heading and anchor fidelity Sep 21, 2026
@matcra587
matcra587 marked this pull request as ready for review September 22, 2026 00:00
@matcra587
matcra587 merged commit b1b6716 into main Sep 22, 2026
13 checks passed
@matcra587
matcra587 deleted the mc/docs-heading-fidelity branch September 22, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant