Merge pull request #17393 from overleaf/mj-tikzcd

[cm6] Don't decorate tikzcd environments

GitOrigin-RevId: bf499432d67cefe12576fc135f4564b97a1b2c13
This commit is contained in:
Mathias Jakobsen 2024-03-04 10:36:42 +00:00 committed by Copybot
parent a4b7c5f468
commit 60d38285ea

View file

@ -715,6 +715,7 @@ export const atomicDecorations = (options: Options) => {
return false // no markup in input content
} else if (nodeRef.type.is('Math')) {
// math equations
let passToMathJax = true
const ancestorNode =
ancestorNodeOfType(state, nodeRef.from, '$MathContainer') ||
@ -743,6 +744,9 @@ export const atomicDecorations = (options: Options) => {
if (environmentName) {
// use the outer content of environments that MathJax supports
// https://docs.mathjax.org/en/latest/input/tex/macros/index.html#environments
if (environmentName === 'tikzcd') {
passToMathJax = false
}
if (
environmentName !== 'math' &&
environmentName !== 'displaymath'
@ -764,7 +768,7 @@ export const atomicDecorations = (options: Options) => {
displayMode = true
}
}
if (passToMathJax) {
decorations.push(
Decoration.replace({
widget: new MathWidget(
@ -777,6 +781,7 @@ export const atomicDecorations = (options: Options) => {
)
}
}
}
return false // never decorate inside math
} else if (nodeRef.type.is('HrefCommand')) {