Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix: multiple inline latex parsing (#2214)
Kada Liao9600fbb609d4
diff --git a/web/src/labs/marked/parser/InlineLatex.tsx b/web/src/labs/marked/parser/InlineLatex.tsxindex 70aae24a7..bf3cecb79 100644--- a/web/src/labs/marked/parser/InlineLatex.tsx+++ b/web/src/labs/marked/parser/InlineLatex.tsx@@ -1,24 +1,20 @@import TeX from "@matejmazur/react-katex";import "katex/dist/katex.min.css";-export const LATEX_INLINE_REG = /\$(.+?)\$|\\\(([^\\]+)\\\)/g;+export const LATEX_INLINE_REG = /\$(.+?)\$|\\\((.+?)\\\)/;const inlineRenderer = (rawStr: string) => {const matchResult = LATEX_INLINE_REG.exec(rawStr);- if (!matchResult) {- return rawStr;+ if (matchResult) {+ let latexCode = "";+ if (matchResult[1]) {+ latexCode = matchResult[1];+ } else if (matchResult[2]) {+ latexCode = matchResult[2];+ }+ return <TeX key={latexCode}>{latexCode}</TeX>;}-- let latexCode = "";-- if (matchResult[1]) {- // $- latexCode = matchResult[1];- } else if (matchResult[2]) {- // \( and \)- latexCode = matchResult[2];- }- return <TeX>{latexCode}</TeX>;+ return rawStr;};export default {