LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。
TypeScript
feat: add KaTeX math rendering across all views
nash_su4d0c6f7bc6b0
diff --git a/package-lock.json b/package-lock.jsonindex 502e527d..c4062957 100644--- a/package-lock.json+++ b/package-lock.json@@ -11,6 +11,7 @@"@base-ui/react": "^1.3.0","@fontsource-variable/geist": "^5.2.8","@milkdown/kit": "^7.20.0",+ "@milkdown/plugin-math": "^7.5.9","@milkdown/react": "^7.20.0","@milkdown/theme-nord": "^7.20.0","@react-sigma/core": "^5.0.6",@@ -24,13 +25,16 @@"graphology-communities-louvain": "^2.0.2","graphology-layout-forceatlas2": "^0.10.1","i18next": "^26.0.3",+ "katex": "^0.16.45","lucide-react": "^1.7.0","react": "^19.0.0","react-dom": "^19.0.0","react-i18next": "^17.0.2","react-markdown": "^10.1.0","react-resizable-panels": "^4.9.0",+ "rehype-katex": "^7.0.1","remark-gfm": "^4.0.1",+ "remark-math": "^6.0.0","shadcn": "^4.1.2","sigma": "^3.0.2","tailwind-merge": "^3.5.0",@@ -1673,6 +1677,70 @@"lodash-es": "^4.17.21"}},+ "node_modules/@milkdown/plugin-math": {+ "version": "7.5.9",+ "resolved": "https://registry.npmjs.org/@milkdown/plugin-math/-/plugin-math-7.5.9.tgz",+ "integrity": "sha512-LzFZKNc7zm3uOTs9mEN/12/X+UdGoyQRp5Gt9GE7lPJ96jOZaGJD0vMtX0mTauTOmUxDQoQS0I7NW1g9UhC6qQ==",+ "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",+ "license": "MIT",+ "dependencies": {+ "@milkdown/exception": "7.5.9",+ "@milkdown/utils": "7.5.9",+ "@types/katex": "^0.16.0",+ "katex": "^0.16.0",+ "remark-math": "^6.0.0",+ "tslib": "^2.5.0"+ },+ "peerDependencies": {+ "@milkdown/core": "^7.2.0",+ "@milkdown/ctx": "^7.2.0",+ "@milkdown/prose": "^7.2.0"+ }+ },+ "node_modules/@milkdown/plugin-math/node_modules/@milkdown/exception": {+ "version": "7.5.9",+ "resolved": "https://registry.npmjs.org/@milkdown/exception/-/exception-7.5.9.tgz",+ "integrity": "sha512-9g+WpiRjgLsVlHt7DotlUmKK9oT6Lsr5TgxE0NdDvtr81CC43mgNtoekI6rg/PatEBBXifDK1GJJ4LKnRSseVQ==",+ "license": "MIT",+ "dependencies": {+ "tslib": "^2.5.0"+ }+ },+ "node_modules/@milkdown/plugin-math/node_modules/@milkdown/utils": {+ "version": "7.5.9",+ "resolved": "https://registry.npmjs.org/@milkdown/utils/-/utils-7.5.9.tgz",+ "integrity": "sha512-udxaIdKm6pOiNACIKR7+NQ7Vj+QivhA5jcRqksEuQOfDFQBFcGaAhGEEiU1cKwE7fmP2ayigfD0IZ01rjLS2fA==",+ "license": "MIT",+ "dependencies": {+ "@milkdown/exception": "7.5.9",+ "nanoid": "^5.0.0",+ "tslib": "^2.5.0"+ },+ "peerDependencies": {+ "@milkdown/core": "^7.2.0",+ "@milkdown/ctx": "^7.2.0",+ "@milkdown/prose": "^7.2.0",+ "@milkdown/transformer": "^7.2.0"+ }+ },+ "node_modules/@milkdown/plugin-math/node_modules/nanoid": {+ "version": "5.1.7",+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.7.tgz",+ "integrity": "sha512-ua3NDgISf6jdwezAheMOk4mbE1LXjm1DfMUDMuJf4AqxLFK3ccGpgWizwa5YV7Yz9EpXwEaWoRXSb/BnV0t5dQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "bin": {+ "nanoid": "bin/nanoid.js"+ },+ "engines": {+ "node": "^18 || >=20"+ }+ },"node_modules/@milkdown/plugin-slash": {"version": "7.20.0","resolved": "https://registry.npmjs.org/@milkdown/plugin-slash/-/plugin-slash-7.20.0.tgz",@@ -4710,6 +4778,101 @@"node": ">= 0.4"}},+ "node_modules/hast-util-from-dom": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/hast-util-from-dom/-/hast-util-from-dom-5.0.1.tgz",+ "integrity": "sha512-N+LqofjR2zuzTjCPzyDUdSshy4Ma6li7p/c3pA78uTwzFgENbgbUrm2ugwsOdcjI1muO+o6Dgzp9p8WHtn/39Q==",+ "license": "ISC",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hastscript": "^9.0.0",+ "web-namespaces": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-from-html": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz",+ "integrity": "sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "devlop": "^1.1.0",+ "hast-util-from-parse5": "^8.0.0",+ "parse5": "^7.0.0",+ "vfile": "^6.0.0",+ "vfile-message": "^4.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-from-html-isomorphic": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-from-html-isomorphic/-/hast-util-from-html-isomorphic-2.0.0.tgz",+ "integrity": "sha512-zJfpXq44yff2hmE0XmwEOzdWin5xwH+QIhMLOScpX91e/NSGPsAzNCvLQDIEPyO2TXi+lBmU6hjLIhV8MwP2kw==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "hast-util-from-dom": "^5.0.0",+ "hast-util-from-html": "^2.0.0",+ "unist-util-remove-position": "^5.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-from-parse5": {+ "version": "8.0.3",+ "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-8.0.3.tgz",+ "integrity": "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "devlop": "^1.0.0",+ "hastscript": "^9.0.0",+ "property-information": "^7.0.0",+ "vfile": "^6.0.0",+ "vfile-location": "^5.0.0",+ "web-namespaces": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-is-element": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz",+ "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },+ "node_modules/hast-util-parse-selector": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz",+ "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/hast-util-to-jsx-runtime": {"version": "2.3.6","resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz",@@ -4737,6 +4900,22 @@"url": "https://opencollective.com/unified"}},+ "node_modules/hast-util-to-text": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz",+ "integrity": "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/unist": "^3.0.0",+ "hast-util-is-element": "^3.0.0",+ "unist-util-find-after": "^5.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/hast-util-whitespace": {"version": "3.0.0","resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",@@ -4750,6 +4929,23 @@"url": "https://opencollective.com/unified"}},+ "node_modules/hastscript": {+ "version": "9.0.1",+ "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz",+ "integrity": "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "comma-separated-tokens": "^2.0.0",+ "hast-util-parse-selector": "^4.0.0",+ "property-information": "^7.0.0",+ "space-separated-tokens": "^2.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/headers-polyfill": {"version": "4.0.3","resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-4.0.3.tgz",@@ -5261,9 +5457,9 @@}},"node_modules/katex": {- "version": "0.16.44",- "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.44.tgz",- "integrity": "sha512-EkxoDTk8ufHqHlf9QxGwcxeLkWRR3iOuYfRpfORgYfqc8s13bgb+YtRY59NK5ZpRaCwq1kqA6a5lpX8C/eLphQ==",+ "version": "0.16.45",+ "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.45.tgz",+ "integrity": "sha512-pQpZbdBu7wCTmQUh7ufPmLr0pFoObnGUoL/yhtwJDgmmQpbkg/0HSVti25Fu4rmd1oCR6NGWe9vqTWuWv3GcNA==","funding": ["https://opencollective.com/katex","https://github.com/sponsors/katex"@@ -7039,6 +7235,30 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/parse5": {+ "version": "7.3.0",+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",+ "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",+ "license": "MIT",+ "dependencies": {+ "entities": "^6.0.0"+ },+ "funding": {+ "url": "https://github.com/inikulin/parse5?sponsor=1"+ }+ },+ "node_modules/parse5/node_modules/entities": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",+ "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",+ "license": "BSD-2-Clause",+ "engines": {+ "node": ">=0.12"+ },+ "funding": {+ "url": "https://github.com/fb55/entities?sponsor=1"+ }+ },"node_modules/parseurl": {"version": "1.3.3","resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",@@ -7561,6 +7781,25 @@"node": ">= 4"}},+ "node_modules/rehype-katex": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-7.0.1.tgz",+ "integrity": "sha512-OiM2wrZ/wuhKkigASodFoo8wimG3H12LWQaH8qSPVJn9apWKFSH3YOCtbKpBorTVw/eI7cuT21XBbvwEswbIOA==",+ "license": "MIT",+ "dependencies": {+ "@types/hast": "^3.0.0",+ "@types/katex": "^0.16.0",+ "hast-util-from-html-isomorphic": "^2.0.0",+ "hast-util-to-text": "^4.0.0",+ "katex": "^0.16.0",+ "unist-util-visit-parents": "^6.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/remark": {"version": "15.0.1","resolved": "https://registry.npmjs.org/remark/-/remark-15.0.1.tgz",@@ -8506,6 +8745,20 @@"url": "https://opencollective.com/unified"}},+ "node_modules/unist-util-find-after": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-5.0.0.tgz",+ "integrity": "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "unist-util-is": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/unist-util-is": {"version": "6.0.1","resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz",@@ -8692,6 +8945,20 @@"url": "https://opencollective.com/unified"}},+ "node_modules/vfile-location": {+ "version": "5.0.3",+ "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.3.tgz",+ "integrity": "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==",+ "license": "MIT",+ "dependencies": {+ "@types/unist": "^3.0.0",+ "vfile": "^6.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/unified"+ }+ },"node_modules/vfile-message": {"version": "4.0.3","resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz",@@ -8819,6 +9086,16 @@"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==","license": "MIT"},+ "node_modules/web-namespaces": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz",+ "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/wooorm"+ }+ },"node_modules/web-streams-polyfill": {"version": "3.3.3","resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",diff --git a/package.json b/package.jsonindex 4579f52a..66530d07 100644--- a/package.json+++ b/package.json@@ -13,6 +13,7 @@"@base-ui/react": "^1.3.0","@fontsource-variable/geist": "^5.2.8","@milkdown/kit": "^7.20.0",+ "@milkdown/plugin-math": "^7.5.9","@milkdown/react": "^7.20.0","@milkdown/theme-nord": "^7.20.0","@react-sigma/core": "^5.0.6",@@ -26,13 +27,16 @@"graphology-communities-louvain": "^2.0.2","graphology-layout-forceatlas2": "^0.10.1","i18next": "^26.0.3",+ "katex": "^0.16.45","lucide-react": "^1.7.0","react": "^19.0.0","react-dom": "^19.0.0","react-i18next": "^17.0.2","react-markdown": "^10.1.0","react-resizable-panels": "^4.9.0",+ "rehype-katex": "^7.0.1","remark-gfm": "^4.0.1",+ "remark-math": "^6.0.0","shadcn": "^4.1.2","sigma": "^3.0.2","tailwind-merge": "^3.5.0",diff --git a/src/components/chat/chat-message.tsx b/src/components/chat/chat-message.tsxindex 83cd0310..daf296e9 100644--- a/src/components/chat/chat-message.tsx+++ b/src/components/chat/chat-message.tsx@@ -1,6 +1,9 @@import { useCallback, useEffect, useRef, useState, useMemo } from "react"import ReactMarkdown from "react-markdown"import remarkGfm from "remark-gfm"+import remarkMath from "remark-math"+import rehypeKatex from "rehype-katex"+import "katex/dist/katex.min.css"import {Bot, User, FileText, BookmarkPlus, ChevronDown, ChevronRight, RefreshCw,Users, Lightbulb, BookOpen, HelpCircle, GitMerge, BarChart3, Layout, Globe,@@ -453,7 +456,8 @@ function MarkdownContent({ content }: { content: string }) {{thinking && <ThinkingBlock content={thinking} />}<div className="chat-markdown prose prose-sm max-w-none dark:prose-invert prose-p:my-1 prose-headings:my-2 prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-pre:my-2 prose-code:text-xs prose-code:before:content-none prose-code:after:content-none"><ReactMarkdown- remarkPlugins={[remarkGfm]}+ remarkPlugins={[remarkGfm, remarkMath]}+ rehypePlugins={[rehypeKatex]}components={{a: ({ href, children }) => {if (href?.startsWith("wikilink:")) {diff --git a/src/components/editor/wiki-editor.tsx b/src/components/editor/wiki-editor.tsxindex 871e16f8..f3159acd 100644--- a/src/components/editor/wiki-editor.tsx+++ b/src/components/editor/wiki-editor.tsx@@ -4,9 +4,11 @@ import { commonmark } from "@milkdown/kit/preset/commonmark"import { gfm } from "@milkdown/kit/preset/gfm"import { history } from "@milkdown/kit/plugin/history"import { listener, listenerCtx } from "@milkdown/kit/plugin/listener"+import { math } from "@milkdown/plugin-math"import { nord } from "@milkdown/theme-nord"import { Milkdown, MilkdownProvider, useEditor } from "@milkdown/react"import "@milkdown/theme-nord/style.css"+import "katex/dist/katex.min.css"import { convertLatexToUnicode } from "@/lib/latex-to-unicode"interface WikiEditorInnerProps {@@ -28,6 +30,7 @@ function WikiEditorInner({ content, onSave }: WikiEditorInnerProps) {}).use(commonmark).use(gfm)+ .use(math).use(history).use(listener),[content],diff --git a/src/components/layout/research-panel.tsx b/src/components/layout/research-panel.tsxindex abcb8850..3a30b5fd 100644--- a/src/components/layout/research-panel.tsx+++ b/src/components/layout/research-panel.tsx@@ -1,5 +1,8 @@import { useState } from "react"import ReactMarkdown from "react-markdown"+import remarkMath from "remark-math"+import rehypeKatex from "rehype-katex"+import "katex/dist/katex.min.css"import {Search, Loader2, CheckCircle2, AlertCircle, ChevronRight, ChevronDown, X,ExternalLink, FileText, Send,@@ -182,7 +185,7 @@ function ResearchTaskCard({ task, onRemove }: { task: ResearchTask; onRemove: (i<div className="mb-2"><div className="mb-1 font-medium text-muted-foreground">Synthesis</div><div className="max-h-64 overflow-y-auto rounded bg-muted/30 p-2 prose prose-xs prose-invert max-w-none">- <ReactMarkdown>{task.synthesis}</ReactMarkdown>+ <ReactMarkdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>{task.synthesis}</ReactMarkdown>{task.status === "synthesizing" && (<span className="animate-pulse">▊</span>)}