style(mathml): linting
This commit is contained in:
parent
7f33ae0f40
commit
1ac9244e68
|
@ -342,7 +342,10 @@ export const renderKatex = async (text: string, config: MermaidConfig): Promise<
|
||||||
}
|
}
|
||||||
|
|
||||||
const { default: katex } = await import('katex');
|
const { default: katex } = await import('katex');
|
||||||
const outputMode = (config.forceLegacyMathML) || (!isMathMLSupported() && config.legacyMathML) ? 'htmlAndMathml' : 'mathml';
|
const outputMode =
|
||||||
|
config.forceLegacyMathML || (!isMathMLSupported() && config.legacyMathML)
|
||||||
|
? 'htmlAndMathml'
|
||||||
|
: 'mathml';
|
||||||
return text
|
return text
|
||||||
.split(lineBreakRegex)
|
.split(lineBreakRegex)
|
||||||
.map((line) =>
|
.map((line) =>
|
||||||
|
@ -356,7 +359,7 @@ export const renderKatex = async (text: string, config: MermaidConfig): Promise<
|
||||||
.renderToString(c, {
|
.renderToString(c, {
|
||||||
throwOnError: true,
|
throwOnError: true,
|
||||||
displayMode: true,
|
displayMode: true,
|
||||||
output: outputMode
|
output: outputMode,
|
||||||
})
|
})
|
||||||
.replace(/\n/g, ' ')
|
.replace(/\n/g, ' ')
|
||||||
.replace(/<annotation.*<\/annotation>/g, '')
|
.replace(/<annotation.*<\/annotation>/g, '')
|
||||||
|
|
|
@ -63,7 +63,7 @@ Example with legacy mode enabled (the latest version of KaTeX's stylesheet can b
|
||||||
|
|
||||||
## Handling Rendering Differences
|
## Handling Rendering Differences
|
||||||
|
|
||||||
Due to differences between default fonts across operating systems and browser's MathML implementations, inconsistent results can be seen across platforms. If having consistent results are important, or the most optimal rendered results are desired, `forceLegacyMathML` can be enabled in the config.
|
Due to differences between default fonts across operating systems and browser's MathML implementations, inconsistent results can be seen across platforms. If having consistent results are important, or the most optimal rendered results are desired, `forceLegacyMathML` can be enabled in the config.
|
||||||
|
|
||||||
This option will always use KaTeX's stylesheet instead of only when MathML is not supported (as with `legacyMathML`). Note that only `forceLegacyMathML` needs to be set.
|
This option will always use KaTeX's stylesheet instead of only when MathML is not supported (as with `legacyMathML`). Note that only `forceLegacyMathML` needs to be set.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue