Skip to content

Build your personal knowledge base with Trilium Notes

chore(search): highlight matches without mark.js

Elian Doran50bd71737b88
diff --git a/.claude/skills/building-client-ui/references/hooks-catalog.md b/.claude/skills/building-client-ui/references/hooks-catalog.md
index b04fb505ee..1da9585637 100644
--- a/.claude/skills/building-client-ui/references/hooks-catalog.md
+++ b/.claude/skills/building-client-ui/references/hooks-catalog.md
@@ -121,7 +121,7 @@ All react to `loadResults.getOptionNames()` and persist via `options.save`.
| `useCollectionTreeDrag(containerRef, opts)` | `useNoteTreeDrag` for a collection view; adds `dragEnabled`/`includeArchived` and warns when dropped notes are archived-and-hidden. |
| `useLongPressContextMenu(handler, holdMs?)` | right-click + touch long-press → context-menu props to spread. |
| `useContainedLinkNavigation(containerRef, onNavigate)` | keep internal note-link clicks inside a popup/dialog instead of the global handler (capture-phase). |
-| `useImperativeSearchHighlighlighting(tokens)` | returns a fn that `mark.js`-highlights search tokens in an element. |
+| `useImperativeSearchHighlighlighting(tokens)` | returns a fn that highlights search tokens (`services/highlight_matches.ts`) in an element. |
| `useMathRendering(containerRef, deps)` | lazily KaTeX-render `.math-tex` elements (TOC/highlights sidebars). |
## Misc utilities
diff --git a/apps/client/package.json b/apps/client/package.json
index ab10b964e3..f7b020867a 100644
--- a/apps/client/package.json
+++ b/apps/client/package.json
@@ -55,7 +55,6 @@
"jquery.fancytree": "2.38.5",
"katex": "0.19.1",
"maplibre-gl": "6.16.0",
- "mark.js": "8.11.1",
"marked": "18.1.1",
"mermaid": "12.2.0",
"mind-elixir": "5.15.1",
@@ -78,7 +77,6 @@
"@types/bootstrap": "5.2.11",
"@types/d3-hierarchy": "3.1.7",
"@types/jquery": "4.0.1",
- "@types/mark.js": "8.11.12",
"@types/tabulator-tables": "6.3.6",
"happy-dom": "21.0.4",
"jsdom": "30.1.3",
diff --git a/apps/client/src/services/highlight_matches.ts b/apps/client/src/services/highlight_matches.ts
new file mode 100644
index 0000000000..c73cc6aa18
--- /dev/null
+++ b/apps/client/src/services/highlight_matches.ts
@@ -0,0 +1,145 @@
+import { escapeRegExp } from "./utils.js";
+
+export interface HighlightOptions {
+ /** The class of the `<span>` that wraps each match. */
+ className: string;
+ /** Selectors of the elements whose own text is not searched. */
+ exclude?: string[];
+ /** The maximum number of matches to wrap. */
+ limit?: number;
+}
+
+/** Elements whose text is never displayed, so a match inside them is never wrapped. */
+const ALWAYS_EXCLUDED = [ "script", "style", "title", "head", "html" ];
+
+/**
+ * Wraps each match of `regExp` in the text under `root`, and returns the wrappers in document
+ * order. A match cannot span two text nodes. {@link removeHighlights} unwraps them again.
+ */
+export function highlightRegExp(root: HTMLElement, regExp: RegExp, options: HighlightOptions) {
+ const global = regExp.global ? regExp : new RegExp(regExp.source, `${regExp.flags}g`);
+ return highlightRanges(root, options, (text) => findRanges(global, text));
+}
+
+/**
+ * Wraps each occurrence of the literal `terms` in the text under `root`, ignoring case and
+ * diacritics the way the server's `normalize()` does, so the unaccented token "ktory" still
+ * matches "ktorý". Whitespace in a term matches any run of whitespace.
+ */
+export function highlightTerms(root: HTMLElement, terms: string[], options: HighlightOptions) {
+ const patterns = terms
+ .map((term) => fold(term).text.trim())
+ .filter((term) => term.length > 0)
+ .sort((a, b) => b.length - a.length)
+ .map((term) => term.split(/\s+/).map(escapeRegExp).join("\\s+"));
+ if (patterns.length === 0) {
+ return [];
+ }
+
+ const regExp = new RegExp(patterns.join("|"), "g");
+ return highlightRanges(root, options, (text) => {
+ const folded = fold(text);
+ return findRanges(regExp, folded.text)
+ .map(([ start, end ]): Range => [ folded.starts[start], folded.ends[end - 1] ]);
+ });
+}
+
+/** Unwraps the elements that {@link highlightRegExp} and {@link highlightTerms} returned. */
+export function removeHighlights(elements: Iterable<HTMLElement>) {
+ for (const element of elements) {
+ const parent = element.parentNode;
+ if (!parent) continue;
+
+ element.replaceWith(...element.childNodes);
+ parent.normalize();
+ }
+}
+
+type Range = [ start: number, end: number ];
+
+function highlightRanges(root: HTMLElement, options: HighlightOptions, getRanges: (text: string) => Range[]) {
+ const excluded = [ ...ALWAYS_EXCLUDED, ...options.exclude ?? [] ].join(",");
+ const limit = options.limit ?? Infinity;
+ const wrappers: HTMLElement[] = [];
+
+ for (const node of getTextNodes(root, excluded)) {
+ const ranges = getRanges(node.data).slice(0, limit - wrappers.length);
+ wrappers.push(...wrapRanges(node, ranges, options.className));
+ if (wrappers.length >= limit) break;
+ }
+
+ return wrappers;
+}
+
+function getTextNodes(root: HTMLElement, excluded: string) {
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
+ acceptNode: (node) => node.parentElement?.matches(excluded)
+ ? NodeFilter.FILTER_REJECT
+ : NodeFilter.FILTER_ACCEPT
+ });
+
+ const nodes: Text[] = [];
+ while (walker.nextNode()) {
+ nodes.push(walker.currentNode as Text);
+ }
+ return nodes;
+}
+
+/** The non-empty matches of the global `regExp` in `text`. */
+function findRanges(regExp: RegExp, text: string) {
+ const ranges: Range[] = [];
+ for (const match of text.matchAll(regExp)) {
+ if (match[0].length > 0) {
+ ranges.push([ match.index, match.index + match[0].length ]);
+ }
+ }
+ return ranges;
+}
+
+function wrapRanges(node: Text, ranges: Range[], className: string) {
+ const wrappers: HTMLElement[] = [];
+ let rest = node;
+ let offset = 0;
+
+ for (const [ start, end ] of ranges) {
+ const matched = rest.splitText(start - offset);
+ rest = matched.splitText(end - start);
+ offset = end;
+
+ const wrapper = document.createElement("span");
+ wrapper.className = className;
+ matched.replaceWith(wrapper);
+ wrapper.append(matched);
+ wrappers.push(wrapper);
+ }
+
+ return wrappers;
+}
+
+/**
+ * Strips the diacritics of `text` and lowercases it, one code point at a time. `starts[i]` and
+ * `ends[i]` are the bounds in `text` of the code point that produced `text[i]` of the result; a
+ * combining mark that folds away joins the code point before it.
+ */
+function fold(text: string) {
+ let folded = "";
+ const starts: number[] = [];
+ const ends: number[] = [];
+ let index = 0;
+
+ for (const char of text) {
+ const end = index + char.length;
+ const replacement = char.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
+ if (replacement.length === 0 && ends.length > 0) {
+ ends[ends.length - 1] = end;
+ }
+ for (let i = 0; i < replacement.length; i++) {
+ starts.push(index);
+ ends.push(end);
+ }
+ folded += replacement;
+ index = end;
+ }
+
+ return { text: folded, starts, ends };
+}
diff --git a/apps/client/src/widgets/collections/board/index.css b/apps/client/src/widgets/collections/board/index.css
index 059604d541..2e618347ef 100644
--- a/apps/client/src/widgets/collections/board/index.css
+++ b/apps/client/src/widgets/collections/board/index.css
@@ -567,7 +567,7 @@ body.mobile .board-view-container .board-add-column {
display: block;
padding-inline-start: calc(var(--card-title-inset) - var(--card-padding));
- /* The spans mark.js wraps a filter's matched tokens in. Matches the search result cards. */
+ /* The spans `highlightTerms()` wraps a filter's matched tokens in. Matches the search result cards. */
.ck-find-result {
background: var(--note-list-view-search-result-highlight-background);
color: var(--note-list-view-search-result-highlight-color);
diff --git a/apps/client/src/widgets/collections/search/SearchResultsList.css b/apps/client/src/widgets/collections/search/SearchResultsList.css
index 64d70d73a5..38ed9f4fd3 100644
--- a/apps/client/src/widgets/collections/search/SearchResultsList.css
+++ b/apps/client/src/widgets/collections/search/SearchResultsList.css
@@ -133,7 +133,7 @@
}
/* Style the server-injected <b> highlights (snippet + attribute badges) and the client-side
- mark.js .ck-find-result spans (title) identically. */
+ .ck-find-result spans (title) identically. */
.search-result-card-title .ck-find-result,
.search-result-card-snippet b,
.search-result-card-badges b {
diff --git a/apps/client/src/widgets/find_in_html.spec.ts b/apps/client/src/widgets/find_in_html.spec.ts
index 78a7ebab21..f84c16c587 100644
--- a/apps/client/src/widgets/find_in_html.spec.ts
+++ b/apps/client/src/widgets/find_in_html.spec.ts
@@ -23,7 +23,7 @@ afterEach(() => {
});
/**
- * Builds a FindInHtml wired to a real (happy-dom) content element, so mark.js can mutate it.
+ * Builds a FindInHtml wired to a real (happy-dom) content element, so the find can mutate it.
*/
function setup(html: string) {
const container = document.createElement("div");
@@ -85,7 +85,7 @@ describe("FindInHtml", () => {
expect(container.innerHTML).toBe("<p>alpha beta gamma</p>");
});
- it("highlightExtraTokens is a no-op before a find has run (no mark instance yet)", async () => {
+ it("highlightExtraTokens is a no-op before a find has run", async () => {
const { finder, container } = setup("<p>alpha beta</p>");
await finder.highlightExtraTokens([ "beta" ]);
diff --git a/apps/client/src/widgets/find_in_html.ts b/apps/client/src/widgets/find_in_html.ts
index e982f31d0f..f5a7a4bae7 100644
--- a/apps/client/src/widgets/find_in_html.ts
+++ b/apps/client/src/widgets/find_in_html.ts
@@ -1,9 +1,8 @@
// ck-find-result and ck-find-result_selected are the styles ck-editor
// uses for highlighting matches, use the same one on CodeMirror
// for consistency
-import type Mark from "mark.js";
-
import { revealElement } from "../services/collapsible.js";
+import { highlightRegExp, highlightTerms, removeHighlights } from "../services/highlight_matches.js";
import utils from "../services/utils.js";
import type FindWidget from "./find.js";
import MergedFind, {
@@ -90,7 +89,6 @@ export default class FindInHtml {
/** Searches rendered content, which it cannot change, by marking up its matches. */
export class HtmlFindTarget implements FindTarget {
- private mark: Mark | null = null;
protected matches: HTMLElement[] = [];
/** The elements that wrap the matches and the extra tokens, which `unmark()` removes. */
private markElements: HTMLElement[] = [];
@@ -100,7 +98,6 @@ export class HtmlFindTarget implements FindTarget {
constructor(readonly root: HTMLElement, private readonly exclude: string[] = []) {}
async find(term: string, { matchCase, wholeWord }: FindOptions) {
- const mark = await this.getMark();
this.unmark();
if (!term) {
return 0;
@@ -111,13 +108,11 @@ export class HtmlFindTarget implements FindTarget {
wholeWordChar + utils.escapeRegExp(term) + wholeWordChar,
matchCase ? "g" : "gi"
);
- await new Promise<void>((done) => mark.markRegExp(regExp, {
- element: "span",
+ this.matches = highlightRegExp(this.root, regExp, {
className: FIND_RESULT_CSS_CLASSNAME,
- exclude: this.exclude,
- each: (element) => this.addMarkElement(element, this.matches),
- done: () => done()
- }));
+ exclude: this.exclude
+ });
+ this.markElements.push(...this.matches);
return this.matches.length;
}
@@ -159,49 +154,21 @@ export class HtmlFindTarget implements FindTarget {
/**
* Highlights `tokens` with the muted secondary style, which the primary matches keep
- * cycling through. mark.js escapes each keyword, so a regex metacharacter cannot inject.
+ * cycling through. The tokens match literally, so a regex metacharacter cannot inject.
*/
async highlightExtraTokens(tokens: string[]) {
- const cleaned = tokens.filter((token) => token.length > 0);
- if (!this.mark || cleaned.length === 0) {
- return;
- }
-
- const { mark } = this;
- await new Promise<void>((done) => mark.mark(cleaned, {
- element: "span",
+ this.markElements.push(...highlightTerms(this.root, tokens, {
className: FIND_RESULT_SECONDARY_CSS_CLASSNAME,
- separateWordSearch: false,
- exclude: this.exclude,
- each: (element) => this.addMarkElement(element),
- done: () => done()
+ exclude: this.exclude
}));
}
- private async getMark() {
- this.mark ??= new (await import("mark.js")).default(this.root);
- return this.mark;
- }
-
- private addMarkElement(element: Element, list?: HTMLElement[]) {
- if (element instanceof HTMLElement) {
- this.markElements.push(element);
- list?.push(element);
- }
- }
-
/**
- * Unwraps the elements of this target only. `Mark.unmark()` would remove the marks of every
- * target in its root, such as those of the embeds in a note.
+ * Unwraps the elements of this target only, not those of the other targets in its root, such
+ * as the embeds in a note.
*/
private unmark() {
- for (const element of this.markElements) {
- const parent = element.parentNode;
- if (!parent) continue;
-
- element.replaceWith(...element.childNodes);
- parent.normalize();
- }
+ removeHighlights(this.markElements);
this.markElements = [];
this.matches = [];
this.current = null;
diff --git a/apps/client/src/widgets/react/RawHtml.tsx b/apps/client/src/widgets/react/RawHtml.tsx
index 3e1462d517..278a19dce4 100644
--- a/apps/client/src/widgets/react/RawHtml.tsx
+++ b/apps/client/src/widgets/react/RawHtml.tsx
@@ -40,7 +40,7 @@ export function getHtml(html: HTMLElementLike) {
}
/**
- * Renders plain text with search-match highlighting. The text is set imperatively so mark.js,
+ * Renders plain text with search-match highlighting. The text is set imperatively so the highlighting,
* which injects `.ck-find-result` spans around matches, does not fight Preact's reconciliation
* of a controlled text child.
*/
diff --git a/apps/client/src/widgets/react/hooks.spec.tsx b/apps/client/src/widgets/react/hooks.spec.tsx
index d2d47ad48c..151b7d308a 100644
--- a/apps/client/src/widgets/react/hooks.spec.tsx
+++ b/apps/client/src/widgets/react/hooks.spec.tsx
@@ -27,39 +27,6 @@ import {
useWhenShown
} from "./hooks";
-/**
- * mark.js delegating to the real implementation, so marking still works, while recording the calls
- * `unmark()` receives — its DOM effect cannot be observed under happy-dom, where it removes nothing.
- */
-const markSpies = vi.hoisted(() => ({ unmark: vi.fn() }));
-
-vi.mock("mark.js", async (importOriginal) => {
- const actual = await importOriginal<{ default: new (ctx: unknown) => Record<string, (...args: unknown[]) => unknown> }>();
-
- return {
- default: class {
- private inner: Record<string, (...args: unknown[]) => unknown>;
-
- constructor(ctx: unknown) {
- this.inner = new actual.default(ctx);
- }
-
- mark(...args: unknown[]) {
- return this.inner.mark(...args);
- }
-
- markRegExp(...args: unknown[]) {
- return this.inner.markRegExp(...args);
- }
-
- unmark(...args: unknown[]) {
- markSpies.unmark(...args);
- return this.inner.unmark(...args);
- }
- }
- };
-});
-
let currentPhase: DelayedVisibilityPhase | undefined;
function Probe({ active }: { active: boolean }) {
@@ -669,7 +636,7 @@ describe("useImperativeSearchHighlighlighting", () => {
return null;
}
- /** Mounts a fresh hook instance (so each call gets its own `Mark` instance) and applies it to `target`. */
+ /** Mounts a fresh hook instance and applies it to `target`. */
function highlight(tokens: (string | HighlightedTokenInfo)[] | null | undefined, html: string) {
target.innerHTML = html;
render(null, container);
@@ -687,8 +654,8 @@ describe("useImperativeSearchHighlighlighting", () => {
/**
* Re-renders the *same* hook instance with new tokens, unlike {@link highlight}, which remounts.
- * Keeping the instance alive is the point: its `Mark` has to survive into the next call for the
- * clear-on-empty behaviour to be observable at all.
+ * Keeping the instance alive is the point: its highlights have to survive into the next call
+ * for the clear-on-empty behaviour to be observable at all.
*/
async function remount(tokens: (string | HighlightedTokenInfo)[] | null | undefined) {
await act(async () => {
@@ -709,6 +676,31 @@ describe("useImperativeSearchHighlighlighting", () => {
expect(markedTexts(el)).toEqual(["ktorý"]);
});
+ it("wraps an unaccented match when searching an accented token", () => {
+ const el = highlight(["ktorý"], "<p>Aky ktory</p>");
+ expect(markedTexts(el)).toEqual(["ktory"]);
+ });
+
+ it("keeps a decomposed accent inside the match it belongs to", () => {
+ const el = highlight(["ktory"], "<p>ktorý a</p>");
+ expect(markedTexts(el)).toEqual(["ktorý"]);
+ });
+
+ it("matches a multi-word token as one phrase across any whitespace, ignoring case", () => {
+ const el = highlight(["Foo bar"], "<p>foo bar foo baz</p>");
+ expect(markedTexts(el)).toEqual(["foo bar"]);
+ });
+
+ it("leaves the content of script and style elements alone", () => {
+ const el = highlight(["needle"], "<p>needle</p><style>.needle {}</style>");
+ expect(markedTexts(el)).toEqual(["needle"]);
+ });
+
+ it("caps the matches of a regex token", () => {
+ const el = highlight([{ token: "a", type: "regex" }], `<p>${"a".repeat(600)}</p>`);
+ expect(markedTexts(el)).toHaveLength(500);
+ });
+
it("wraps a CJK substring match inside a larger word", () => {
const el = highlight(["笔记"], "<p>我的笔记本</p>");
expect(markedTexts(el)).toEqual(["笔记"]);
@@ -717,31 +709,25 @@ describe("useImperativeSearchHighlighlighting", () => {
it("clears previous highlights once the tokens are cleared", async () => {
// Callers that keep the same element and merely drop the tokens — emptying a filter box —
// rely on this, or the old highlights stay in the DOM for good.
- //
- // The removal itself is asserted through mark.js rather than the DOM: its `unmark()` is a
- // no-op under happy-dom (it removes nothing even from a fresh instance), so only the call
- // can be observed here.
await remount([ "needle" ]);
const el = content("<p>a needle here</p>");
liveHighlight?.(el);
- expect(el.querySelectorAll(".ck-find-result").length).toBeGreaterThan(0);
- markSpies.unmark.mockClear();
+ expect(markedTexts(el)).toEqual([ "needle" ]);
await remount(null);
liveHighlight?.(el);
- expect(markSpies.unmark).toHaveBeenCalled();
+ expect(el.innerHTML).toBe("<p>a needle here</p>");
+ expect(el.querySelector("p")?.childNodes).toHaveLength(1);
el.remove();
});
it("does not touch an element that was never highlighted", async () => {
await remount(null);
const el = content("<p>a needle here</p>");
- markSpies.unmark.mockClear();
liveHighlight?.(el);
- expect(markSpies.unmark).not.toHaveBeenCalled();
expect(el.innerHTML).toBe("<p>a needle here</p>");
el.remove();
});
@@ -756,6 +742,11 @@ describe("useImperativeSearchHighlighlighting", () => {
expect(markedTexts(target)).toEqual([]);
});
+ it("wraps only the non-empty matches of a regex that can match nothing", () => {
+ const el = highlight([{ token: "o*", type: "regex" }], "<p>foo bar</p>");
+ expect(markedTexts(el)).toEqual(["oo"]);
+ });
+
it("still highlights when given legacy string[] input", () => {
const el = highlight(["bar"], "<p>foo bar baz</p>");
expect(markedTexts(el)).toEqual(["bar"]);
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index 3a34921ada..521718adf3 100644
--- a/apps/client/src/widgets/react/hooks.tsx
+++ b/apps/client/src/widgets/react/hooks.tsx
@@ -6,7 +6,6 @@ import {
UserTheme
} from "@triliumnext/commons";
import { Tooltip } from "bootstrap";
-import Mark from "mark.js";
import { CSSProperties, Ref, RefObject, VNode } from "preact";
import { useSyncExternalStore } from "preact/compat";
import { useCallback, useContext, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";
@@ -19,6 +18,7 @@ import FNote from "../../entities/fnote";
import attributes from "../../services/attributes";
import { expandAncestorDetails } from "../../services/collapsible";
import froca from "../../services/froca";
+import { highlightRegExp, highlightTerms, removeHighlights } from "../../services/highlight_matches";
import { t } from "../../services/i18n";
import keyboard_actions from "../../services/keyboard_actions";
import { formatShortcut, joinShortcut } from "../../services/keyboard_shortcut_display";
@@ -1770,13 +1770,13 @@ export function useSyncedRef<T>(
/** Longer regex tokens are rejected outright rather than compiled, to avoid pathological patterns. */
const MAX_REGEX_TOKEN_LENGTH = 1000;
-/** Caps the number of matches a single regex token can wrap, mirroring the cap mark.js's own term API implicitly applies via node-at-a-time processing. */
+/** Caps the number of matches a single regex token can wrap. */
const MAX_REGEX_MATCHES = 500;
export function useImperativeSearchHighlighlighting(
highlightedTokens: (string | HighlightedTokenInfo)[] | null | undefined
) {
- const mark = useRef<Mark | undefined>(undefined);
+ const highlights = useRef<HTMLElement[]>([]);
const tokenInfos = useMemo<HighlightedTokenInfo[] | null>(() => {
if (!highlightedTokens?.length) return null;
return highlightedTokens.map((token) => (typeof token === "string" ? { token, type: "plain" as const } : token));
@@ -1785,35 +1785,19 @@ export function useImperativeSearchHighlighlighting(
return (el: HTMLElement | null | undefined) => {
if (!el) return;
- // Nothing has ever been highlighted here, so there is also nothing to clear.
- if (!mark.current && !tokenInfos) return;
-
- if (!mark.current) {
- mark.current = new Mark(el);
- }
-
// Clearing comes first and happens even with no tokens left: callers that keep the same
// element and merely drop the tokens (e.g. emptying a filter box) rely on this to remove the
// previous highlights, which would otherwise stay in the DOM for good.
- mark.current.unmark();
+ removeHighlights(highlights.current);
+ highlights.current = [];
if (!tokenInfos) return;
+ // `highlightTerms()` ignores diacritics, so an unaccented query like "ktory" (the server
+ // strips diacritics before indexing) still highlights "ktorý" (#10616). It matches
+ // substrings, so CJK tokens without word boundaries ("笔记" in "我的笔记本") work too.
const plainTokens = tokenInfos.filter((info) => info.type === "plain").map((info) => info.token);
- if (plainTokens.length) {
- // Term API (not markRegExp): its diacritics map lets an unaccented query like "ktory"
- // (the server strips diacritics before indexing) still highlight "ktorý" (#10616).
- // separateWordSearch: false keeps a multi-word token as one literal phrase; the default
- // "partially" accuracy keeps plain substring matching, so CJK tokens without word
- // boundaries (e.g. "笔记" inside "我的笔记本") keep working.
- mark.current.mark(plainTokens, {
- separateWordSearch: false,
- diacritics: true,
- caseSensitive: false,
- element: "span",
- className: "ck-find-result"
- });
- }
+ highlights.current.push(...highlightTerms(el, plainTokens, { className: "ck-find-result" }));
for (const info of tokenInfos) {
if (info.type !== "regex" || info.token.length > MAX_REGEX_TOKEN_LENGTH) continue;
@@ -1826,13 +1810,10 @@ export function useImperativeSearchHighlighlighting(
continue;
}
- mark.current.markRegExp(regex, {
- element: "span",
+ highlights.current.push(...highlightRegExp(el, regex, {
className: "ck-find-result",
- // markRegExp's filter is called as (node, match, totalCounter so far); returning
- // false once the cap is hit stops further matches from being wrapped.
- filter: (_node, _match, totalCounter) => totalCounter < MAX_REGEX_MATCHES
- });
+ limit: MAX_REGEX_MATCHES
+ }));
}
// Reveal matches that landed inside collapsed <details> blocks, which are highlighted in
diff --git a/apps/standalone/package.json b/apps/standalone/package.json
index 0daefcc3cd..2a1282e1e4 100644
--- a/apps/standalone/package.json
+++ b/apps/standalone/package.json
@@ -48,7 +48,6 @@
"scrypt-js": "3.0.1",
"katex": "0.19.1",
"maplibre-gl": "6.16.0",
- "mark.js": "8.11.1",
"marked": "18.1.1",
"mermaid": "12.2.0",
"mind-elixir": "5.15.1",
@@ -67,7 +66,6 @@
"@prefresh/vite": "4.0.1",
"@types/bootstrap": "5.2.11",
"@types/jquery": "4.0.1",
- "@types/mark.js": "8.11.12",
"@types/reveal.js": "5.2.2",
"@types/tabulator-tables": "6.3.6",
"cross-env": "10.1.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 953ac751f6..d828f81545 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -309,9 +309,6 @@ importers:
maplibre-gl:
specifier: 6.16.0
version: 6.16.0
- mark.js:
- specifier: 8.11.1
- version: 8.11.1
marked:
specifier: 18.1.1
version: 18.1.1
@@ -373,9 +370,6 @@ importers:
'@types/jquery':
specifier: 4.0.1
version: 4.0.1
- '@types/mark.js':
- specifier: 8.11.12
- version: 8.11.12
'@types/tabulator-tables':
specifier: 6.3.6
version: 6.3.6
@@ -947,9 +941,6 @@ importers:
maplibre-gl:
specifier: 6.16.0
version: 6.16.0
- mark.js:
- specifier: 8.11.1
- version: 8.11.1
marked:
specifier: 18.1.1
version: 18.1.1
@@ -1002,9 +993,6 @@ importers:
'@types/jquery':
specifier: 4.0.1
version: 4.0.1
- '@types/mark.js':
- specifier: 8.11.12
- version: 8.11.12
'@types/reveal.js':
specifier: 5.2.2
version: 5.2.2
@@ -4896,9 +4884,6 @@ packages:
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
- '@types/[email protected]':
- resolution: {integrity: sha512-244ZnaIBpz4c6xutliAnYVZp6xJlmC569jZqnR3ElO1Y01ooYASSVQEqpd2x0A2UfrgVMs5V9/9tUAdZaDMytQ==}
-
resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
@@ -8941,9 +8926,6 @@ packages:
resolution: {integrity: sha512-gApO66EMtoDZuio680RUBvskR7ahFd/NNhLN4tBAs+Y7FeT4gQV8zVFgYVMRmFxQznOEzecW19w6xOd9XjZjiA==}
engines: {node: '>=16.14.0', npm: '>=8.1.0'}
- resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==}
-
resolution: {integrity: sha512-L//tDAkjTjJCU6pBUSBTgs3Kg4InVaZuUZog/b6V12UKhcDQ7S78877ibbCanRExwPuYP1CZD7Gd2dxSy1GXRg==}
hasBin: true
@@ -15906,10 +15888,6 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]':
- dependencies:
- '@types/jquery': 4.0.1
-
dependencies:
'@types/unist': 3.0.3
@@ -20958,8 +20936,6 @@ snapshots:
quickselect: 3.0.0
tinyqueue: 3.0.0
-
dependencies:
argparse: 2.0.1