diff --git a/src/lib/components/FindBar.svelte b/src/lib/components/FindBar.svelte index fc0c7ca..8f6425f 100644 --- a/src/lib/components/FindBar.svelte +++ b/src/lib/components/FindBar.svelte @@ -30,10 +30,13 @@ function isHostElement(el: Element | null): boolean { if (!el) return false; + // Skip elements whose text is not user-visible (script/style/noscript) + // and our own find marks (to avoid re-walking already-highlighted text). + // CODE and PRE intentionally NOT skipped: code blocks contain real + // content the user expects to be searchable, even when highlight.js + // has wrapped tokens in nested s. const tag = el.tagName; return ( - tag === 'CODE' || - tag === 'PRE' || tag === 'SCRIPT' || tag === 'STYLE' || tag === 'NOSCRIPT' ||