Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(web): keep markdown source selection from lighting up other copies

tianma-if668b9512d102
diff --git a/apps/web/src/components/editor/MarkdownSourceEditor.tsx b/apps/web/src/components/editor/MarkdownSourceEditor.tsx
index e8ef5a4e..d30501f2 100644
--- a/apps/web/src/components/editor/MarkdownSourceEditor.tsx
+++ b/apps/web/src/components/editor/MarkdownSourceEditor.tsx
@@ -273,7 +273,10 @@ export const MarkdownSourceEditor = forwardRef<MarkdownSourceEditorRef, Markdown
autocompletion: false,
rectangularSelection: false,
crosshairCursor: false,
- highlightSelectionMatches: true,
+ // Occurrence highlighting paints other copies of the selected
+ // text with a selection-like color, so a short phrase also
+ // lights up later list items and looks like extra selection.
+ highlightSelectionMatches: false,
closeBracketsKeymap: true,
searchKeymap: true,
foldKeymap: false,
diff --git a/apps/web/src/lib/markdown-theme.test.mjs b/apps/web/src/lib/markdown-theme.test.mjs
index d70b65f3..0159c78a 100644
--- a/apps/web/src/lib/markdown-theme.test.mjs
+++ b/apps/web/src/lib/markdown-theme.test.mjs
@@ -54,6 +54,12 @@ describe("markdown theme contracts", () => {
expect(editorSource).toContain("xcodeLightInit({ styles: lightMarkdownHighlightStyles })");
});
+ test("markdown source mode does not highlight other occurrences of the current selection", () => {
+ const editorSource = readFileSync(new URL("../components/editor/MarkdownSourceEditor.tsx", import.meta.url), "utf8");
+ expect(editorSource).toContain("highlightSelectionMatches: false");
+ expect(editorSource).not.toContain("highlightSelectionMatches: true");
+ });
+
test("the editor toolbar can switch Markdown source themes", () => {
const toolbar = readFileSync(new URL("../components/EditorToolbar.tsx", import.meta.url), "utf8");
expect(toolbar).toContain("useMarkdownTheme");