修复katex角标漂移等问题

This commit is contained in:
undefined committed 2020-06-24 11:47:43 +08:00
1 parent 1f1efe900c
commit a248425db6
17 files changed
+491 -235

No files matched your search

+15
View File
@@ -34,4 +34,19 @@ module.exports = {
console.error('Cannot hack yargs');
}
},
'markdown-it-katex': () => {
const p = require.resolve('markdown-it-katex');
const file = fs.readFileSync(p).toString().split('\n');
if (file[27].includes('if (prevChar === 0x20/* " " */ || prevChar === 0x09/* \\t */ ||')) {
file[27] = 'if (prevChar === 0x09/* \\t */ ||';
} else if (!file[27].includes('if (prevChar === 0x09/* \\t */ ||')) {
console.error('Cannot hack markdown-it-katex');
}
if (file[31].includes('if (nextChar === 0x20/* " " */ || nextChar === 0x09/* \\t */) {')) {
file[31] = 'if (nextChar === 0x09/* \\t */) {';
} else if (!file[27].includes('if (nextChar === 0x09/* \\t */) {')) {
console.error('Cannot hack markdown-it-katex');
}
fs.writeFileSync(p, file.join('\n'));
},
};