Skip to content

Commit 352f2e9

Browse files
committed
fix: replace displaylines with gather*
Fixes #28
1 parent 3aa622d commit 352f2e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/popup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ export async function openPopup(
153153

154154
let done = false
155155
const wrapLaTeX = (latex: string) => {
156-
// HACK: `lines` environment is not supported by KaTeX.
157-
// It was replaced by `\displaylines` in 0.98.5 which is also not supported.
158-
if (latex.startsWith('\\begin{lines}')) {
159-
latex = latex.replaceAll('{lines}', '{gather}')
156+
// HACK: `\displaylines` is not supported by KaTeX.
157+
const matchLines = latex.match(/^\{\\displaylines(?<content>.*)\}$/s)
158+
if (matchLines !== null && matchLines.groups !== undefined) {
159+
latex = `\\begin{gather*}${matchLines.groups.content}\\end{gather*}`
160160
}
161161
if (delim !== '$' && logseq.settings?.preferMultiline) {
162162
latex = latex

0 commit comments

Comments
 (0)