Skip to content

Commit d9664af

Browse files
committed
bump tex2typst and fix math deserialization
1 parent f62d0a9 commit d9664af

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"react-dom": "^18.3.1",
3939
"react-error-boundary": "^6.0.0",
4040
"react-i18next": "^15.7.4",
41-
"tex2typst": "^0.3.26",
41+
"tex2typst": "^0.4.0",
4242
"zod": "^3.25.76"
4343
},
4444
"devDependencies": {

src/compilers/lexical2typst.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,14 @@ export const converters: {
149149
return result
150150
},
151151
math: (math) => {
152-
let result = tex2typst(math.expandedFormula ?? math.formula ?? "", {
153-
customTexMacros: { "\\differentialD": "\\text{d}" },
154-
})
152+
let formula = math.expandedFormula
153+
if (!formula) {
154+
formula = math.formula
155+
}
156+
if (!formula) {
157+
formula = ""
158+
}
159+
let result = tex2typst(formula)
155160
.trim()
156161
.replaceAll("placeholder", "#sym.space")
157162
if (math.inline) {

src/components/plugins/math.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class MathNode extends DecoratorNode<React.ReactNode> {
5959
self.setFormula(serializedNode.formula)
6060
}
6161
if (typeof serializedNode.expandedFormula === "string") {
62-
self.setFormula(serializedNode.expandedFormula)
62+
self.setExpandedFormula(serializedNode.expandedFormula)
6363
}
6464
return self
6565
}

0 commit comments

Comments
 (0)