Skip to content

Commit 4709b6d

Browse files
ho-man-chancmurtagharzola
authored
chore: deploy to production (#138)
* fix: remove unneeded temporary deploy meta data * fix: remove unneeded deploy meta data * feat: mathjax-3 (#103) * feat: mathjax-3 * physics wip * wip add test cases * wip add gh action * add matrix test and handle htmlentities * strip require and improve tests * feat: base 64 formulas support (#113) * feat: base 64 formulas support * different test for gh * gh approach * fix asciimath parameters * remove console * mathml with base64 * chore: add claudia deploy instruction to use linux dependencies (#114) * chore: add claudia deploy instruction to use linux dependencies * improve readme --------- Co-authored-by: Oscar Arzola <oscararzola@gmail.com> * fix: physics should be required explicitly (#118) * improve tests * improve tests * remove log * remove log * remove log * fix: percent symbol formulas (#132) * fix: mathml % formulas (#137) * chore: remove dependabot in production since it is used in dev only chore: update claudia.json to use production --------- Co-authored-by: Christopher Murtagh <christopher@pressbooks.com> Co-authored-by: Oscar Arzola <oscararzola@gmail.com>
1 parent a2528ef commit 4709b6d

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/imageGenerator.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@ module.exports.generate = async (configs, req, res, next) => {
8686

8787
try {
8888
// Temporarily encode LaTeX percent signs to avoid issues with decodeURIComponent
89-
decodedMath = decodedMath.replace(/\\\%/g, '__PERCENT__');
89+
decodedMath = decodedMath.replace(/\\\%/g, "__PERCENT__");
90+
// Handle MathML
91+
decodedMath = decodedMath.replace(
92+
/<(m[a-z]+)>%<\/\1>/g,
93+
"<$1>__MATHPERCENT__</$1>",
94+
);
9095
decodedMath = decodeURIComponent(decodedMath);
91-
// Restore LaTeX percent signs
92-
decodedMath = decodedMath.replace(/__PERCENT__/g, '\\%');
93-
decodedMath = decodedMath.replace(/&#038;/g, '&').replace(/&#38;/g, '&');
96+
// Restore LaTeX and MathML percent signs
97+
decodedMath = decodedMath.replace(/__PERCENT__/g, "\\%");
98+
decodedMath = decodedMath.replace(/__MATHPERCENT__/g, "%");
99+
decodedMath = decodedMath.replace(/&#038;/g, "&").replace(/&#38;/g, "&");
94100
decodedMath = decode(decodedMath);
95101
} catch (decodeError) {
96102
return handleError(res);

0 commit comments

Comments
 (0)