chore: format

This commit is contained in:
Timothy J. Baek 2024-09-24 18:10:14 +02:00
parent 3ff52fd1ad
commit e703e172e2
1 changed files with 7 additions and 13 deletions

View File

@ -8,7 +8,7 @@ const DELIMITER_LIST = [
{ left: '\\ce{', right: '}', display: false }, { left: '\\ce{', right: '}', display: false },
{ left: '\\(', right: '\\)', display: false }, { left: '\\(', right: '\\)', display: false },
{ left: '\\[\n', right: '\n\\]', display: true }, { left: '\\[\n', right: '\n\\]', display: true },
{ left: '\\[', right: '\\]', display: false }, { left: '\\[', right: '\\]', display: false }
]; ];
// const DELIMITER_LIST = [ // const DELIMITER_LIST = [
@ -34,13 +34,9 @@ function generateRegexRules(delimiters) {
const escapedRight = escapeRegex(right); const escapedRight = escapeRegex(right);
if (!display) { if (!display) {
inlinePatterns.push( inlinePatterns.push(`${escapedLeft}((?:\\\\[^]|[^\\\\])+?)${escapedRight}`);
`${escapedLeft}((?:\\\\[^]|[^\\\\])+?)${escapedRight}`
);
} else { } else {
blockPatterns.push( blockPatterns.push(`${escapedLeft}((?:\\\\[^]|[^\\\\])+?)${escapedRight}`);
`${escapedLeft}((?:\\\\[^]|[^\\\\])+?)${escapedRight}`
);
} }
}); });
@ -56,7 +52,7 @@ export default function (options = {}) {
return { return {
extensions: [ extensions: [
blockKatex(options), // This should be on top to prevent conflict with inline delimiters. blockKatex(options), // This should be on top to prevent conflict with inline delimiters.
inlineKatex(options), inlineKatex(options)
] ]
}; };
} }
@ -119,13 +115,11 @@ function katexTokenizer(src, tokens, displayMode: boolean) {
type, type,
raw: match[0], raw: match[0],
text: text, text: text,
displayMode, displayMode
}; };
} }
} }
function inlineKatex(options) { function inlineKatex(options) {
return { return {
name: 'inlineKatex', name: 'inlineKatex',
@ -135,7 +129,7 @@ function inlineKatex(options) {
}, },
tokenizer(src, tokens) { tokenizer(src, tokens) {
return katexTokenizer(src, tokens, false); return katexTokenizer(src, tokens, false);
}, }
}; };
} }
@ -148,6 +142,6 @@ function blockKatex(options) {
}, },
tokenizer(src, tokens) { tokenizer(src, tokens) {
return katexTokenizer(src, tokens, true); return katexTokenizer(src, tokens, true);
}, }
}; };
} }