From 931d079b2f938e65e8cd3eac35cca4988d44c9ea Mon Sep 17 00:00:00 2001 From: Arno Gourdol Date: Mon, 2 Dec 2024 12:16:29 +0100 Subject: [PATCH] fix: fixed #2530 --- CHANGELOG.md | 6 ++++++ src/formats/parse-math-string.ts | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59ad46530..1d75fe6b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [Unreleased] + +### Issues Resolved + +- **#2530** The AsciiMath `1/2` is now parsed as `\frac{1}{2}` + ## 0.102.0 _2024-11-29_ ### Issues Resolved diff --git a/src/formats/parse-math-string.ts b/src/formats/parse-math-string.ts index 9e89291fa..7f9654d57 100644 --- a/src/formats/parse-math-string.ts +++ b/src/formats/parse-math-string.ts @@ -130,8 +130,9 @@ function parseMathExpression( return `\\text{${m[1]}}${parseMathExpression(m[2], options)}`; } - m = s.match(/^([^a-zA-Z0-9\(\{\[\_\^\\\s"]+)(.*)/);; - // A string of symbols... + m = s.match(/^([^a-zA-Z0-9\(\{\[\_\^\\\s"]+)(.*)/); + // Starts with a string of symbols, e.g. "=123", ">=b" + // Exclude "123x" or "abc=" // Could be a binary or relational operator, etc... if (m) { return `${paddedShortcut(m[1], inlineShortcuts)}${parseMathExpression(