mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #3528] [MERGED] feat(docs): highlight search terms in the in-app docs viewer #5981
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#5981
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3528
Author: @kolacheee
Created: 7/12/2026
Status: ✅ Merged
Merged: 7/12/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/docs-search-highlight📝 Commits (6)
42450d0feat(docs): highlight search terms in the docs viewer88bf5d4docs: changelog entry for docs-viewer search highlighting8006403fix(docs): harden search highlighting against reconcile and Unicode edge cases6ef6ed2Merge branch 'staging' into feat/docs-search-highlight02d9c39Merge remote-tracking branch 'origin/staging' into feat/docs-search-highlight9148661Address docs search review feedback📊 Changes
3 files changed (+177 additions, -11 deletions)
View changed files
📝
CHANGELOG.md(+6 -0)📝
packages/client/src/components/modals/DocsViewerModal.tsx(+159 -11)📝
packages/client/src/styles/globals.css(+12 -0)📄 Description
Linked issue
No filed issue — this is a direct UX request from the contributor's own use of the docs viewer (searching the guides gives match counts and snippets, but nothing shows where the matches are once a guide is open). Happy to open a tracking issue if maintainers prefer one on record.
Why this change
The in-app docs viewer's search tells you that a guide matches (count badge, snippet lines) but not where — opening a result scrolls near the first occurrence and then you're on your own, scanning paragraphs for the word you typed. This highlights the search term everywhere it appears so users can actually see what they searched for.
What changed
toLowerCase()+indexOf— never a regex — so highlights agree with the server's match counts, and metacharacter queries (c++,a|b) match literally. The needle is capped at 200 chars like the server's.useDocContentkeeps the previous doc asplaceholderData, so the tree could change identity without aselectedchange, and React would reconcile against effect-mutated DOM (stale text or aninsertBeforecrash); the key forces a clean remount instead. This also hardens the pre-existing Copy-button augmentation. (2) Text wheretoLowerCase()changes string length (e.g.İ→i+ U+0307) is skipped rather than highlighted at misaligned offsets..docs-search-mark) next to the existing.mari-md-highlightrule — primary-tinted viacolor-mix, readable in both themes, visually distinct from markdown==highlight==yellow, and self-scoping (nothing outside the docs viewer emits it).Files:
packages/client/src/components/modals/DocsViewerModal.tsx,packages/client/src/styles/globals.css,CHANGELOG.md. Client-only; no server or shared-package changes.Review process
Built and reviewed with a tiered multi-agent pipeline: recon scanners mapped the search backend semantics, renderer internals, styling conventions, and regression surface; a synthesis pass produced the design; four adversarial reviewers (DOM lifecycle, regressions, hostile inputs, perf/a11y) generated findings that were each independently double-verified — 1 confirmed (the Unicode offset case, fixed), 2 refuted with reproducible reasoning (a needle-cap mismatch that is provably a no-op since server snippets are ≤160 chars, and a misapplied WCAG 1.4.11 claim). The placeholderData reconcile hazard was caught in a final manual pass and fixed.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated on the dev machine:
pnpm lintclean (shared + server + client typechecks + eslint); client production build clean. (pnpm check's full build step remains blocked on this Windows dev machine by the pre-existing #3162 build-script bug; the typechecks it wraps pass.)To verify in a real browser before merge:
Docs and release impact
Docs touched:
CHANGELOG.md(entry under a new[Unreleased]section). No version bump.UI evidence (if applicable)
Screenshots pending the manual verification pass.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.