Skip to content

Commit cebf9cd

Browse files
committed
revert: don't expand macros supported by KaTeX
This reverts commit 79c5011. Wait until arnog/mathlive#1565
1 parent c880ad4 commit cebf9cd

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

src/ml-tweak.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
1-
import type { MathfieldElement, Keybinding, MacroDictionary } from 'mathlive'
2-
3-
// NOTE: This list is not complete. Contributions welcome.
4-
const KNOWN_MACROS = ['bra', 'ket', 'braket', 'Bra', 'Ket', 'Braket']
1+
import type { MathfieldElement, Keybinding } from 'mathlive'
52

63
export function configureMF(mfe: MathfieldElement) {
74
mfe.smartFence = logseq.settings?.smartFence ?? true
85
mfe.smartMode = logseq.settings?.smartMode ?? false
96
mfe.smartSuperscript = logseq.settings?.smartSuperscript ?? false
10-
117
// Filter out compute engine related stuffs
128
mfe.menuItems = mfe.menuItems.filter((item) => !item.id?.startsWith('ce-'))
13-
14-
// Don't expand macros supported by KaTeX
15-
const macros: MacroDictionary = {}
16-
for (const macro in mfe.macros) {
17-
if (KNOWN_MACROS.includes(macro)) {
18-
const macroDef = mfe.macros[macro]
19-
macros[macro] =
20-
typeof macroDef === 'string'
21-
? { def: macroDef, expand: false }
22-
: { ...macroDef, expand: false }
23-
} else {
24-
macros[macro] = mfe.macros[macro]
25-
}
26-
}
27-
mfe.macros = macros
28-
299
try {
3010
mfe.keybindings = [
3111
...mfe.keybindings.filter(

0 commit comments

Comments
 (0)