1
0
mirror of synced 2026-08-05 21:06:55 +00:00

FEATURE: add support for multilingual mathjax (#84)

Chinese / Korean / Japanese / Thai and Arabic use different punctuations.
This commit is contained in:
Sam
2024-06-11 18:02:45 +10:00
committed by GitHub
parent d6ec11d1bc
commit 718c0ce770
2 changed files with 50 additions and 0 deletions
@@ -3,6 +3,28 @@
//
//
const additionalPunctuation = [
// Chinese and Japanese punctuation
0x3001, // 、
0x3002, // 。
// Full-width punctuation used in East Asian languages
0xff0c, //
0xff1a, //
0xff1b, //
0xff0e, //
0xff1f, //
0xff01, //
// Arabic punctuation
0x060c, // ،
0x061b, // ؛
0x061f, // ؟
// Thai punctuation
0x0e2f, // ฯ
];
function isSafeBoundary(character_code, delimiter_code, md) {
if (character_code === delimiter_code) {
return false;
@@ -20,6 +42,10 @@ function isSafeBoundary(character_code, delimiter_code, md) {
return true;
}
if (additionalPunctuation.includes(character_code)) {
return true;
}
return false;
}