Skip to content

docs: strip heading-id markers from the MCP search text - #1785

Merged
chhoumann merged 1 commit into
masterfrom
docs/mcp-index-strip-heading-ids
Sep 22, 2026
Merged

chhoumann merged 1 commit into
masterfrom
docs/mcp-index-strip-heading-ids

Conversation

@chhoumann

@chhoumann chhoumann commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Summary

/docs-index.json feeds the /mcp server's search_quickadd_docs tool. Its headings field already drops the {#custom-id} suffixes, but the text field kept all 313 of them. They leaked into search snippets on the live site (e.g. ### Linux {#linux} for the query "linux cron"), and the id text also counted toward term matches.

Changes

  • src/pages/docs-index.json.ts: strip a trailing {#id} from each line of text, the same way headings already does. Every {# in the docs is a heading suffix (checked with grep), so nothing else is affected.

Testing / validation

  • Build: exit 0, 52 pages.
  • docs-index.json compared with master: slugs, titles, descriptions, headings and URLs are unchanged. Each text field differs only by the removed markers (313 → 0).
  • Ran the real functions/mcp.ts onRequest handler under Node, with ASSETS served from each build. For "linux cron", "quick reference" and "capture daily note", markers in results go from 2/0/0 to 0/0/0, and the top results are the same.

Checklist

Note

Strip heading-id markers from MCP search text in docs-index.json.ts

Updates the page-text normalization in the docs index API handler to remove explicit heading anchor markers and adjacent line-end whitespace after fenced-code removal. Heading extraction logic is unchanged.

Macroscope summarized deeb6e2.

Summary by CodeRabbit

  • Bug Fixes
    • Documentation page text no longer includes heading custom ID annotations such as {#...}.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: bf7f27bc-b343-40ae-9cc9-aed9c82fd04d

📥 Commits

Reviewing files that changed from the base of the PR and between ce44a43 and deeb6e2.

📒 Files selected for processing (1)
  • docs/src/pages/docs-index.json.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The docs manifest text pipeline now removes trailing {#...} heading annotations before it collapses whitespace.

Changes

Docs manifest text extraction

Layer / File(s) Summary
Heading annotation removal
docs/src/pages/docs-index.json.ts
The text pipeline removes trailing {#...} annotations with surrounding whitespace before whitespace normalization.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to deeb6

The manifest cleanup has no identified user-visible regression and is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
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: removing heading ID markers from MCP search text.
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 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

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

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: deeb6e2
Status: ✅  Deploy successful!
Preview URL: https://2bb60cde.quickadd.pages.dev
Branch Preview URL: https://docs-mcp-index-strip-heading.quickadd.pages.dev

View logs

@chhoumann
chhoumann merged commit ebec039 into master Sep 22, 2026
16 checks passed
@chhoumann
chhoumann deleted the docs/mcp-index-strip-heading-ids branch September 22, 2026 18:42
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