From 1ac9244e68973b39f269a4c7b237b33c49395992 Mon Sep 17 00:00:00 2001 From: NicolasNewman Date: Mon, 29 Apr 2024 09:46:50 -0500 Subject: [PATCH] style(mathml): linting --- packages/mermaid/src/diagrams/common/common.ts | 7 +++++-- packages/mermaid/src/docs/config/math.md | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/mermaid/src/diagrams/common/common.ts b/packages/mermaid/src/diagrams/common/common.ts index c6537e390..66cc5ff6f 100644 --- a/packages/mermaid/src/diagrams/common/common.ts +++ b/packages/mermaid/src/diagrams/common/common.ts @@ -342,7 +342,10 @@ export const renderKatex = async (text: string, config: MermaidConfig): Promise< } 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 .split(lineBreakRegex) .map((line) => @@ -356,7 +359,7 @@ export const renderKatex = async (text: string, config: MermaidConfig): Promise< .renderToString(c, { throwOnError: true, displayMode: true, - output: outputMode + output: outputMode, }) .replace(/\n/g, ' ') .replace(//g, '') diff --git a/packages/mermaid/src/docs/config/math.md b/packages/mermaid/src/docs/config/math.md index 6b203c52d..a53dceaf2 100644 --- a/packages/mermaid/src/docs/config/math.md +++ b/packages/mermaid/src/docs/config/math.md @@ -63,7 +63,7 @@ Example with legacy mode enabled (the latest version of KaTeX's stylesheet can b ## 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.