From 0f3663e2c4c5ede6c8f7b4eb4c6cddb1a6e192c3 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 18 Feb 2026 14:10:35 -0500 Subject: [PATCH] Fix inline linebreaking issues with SVG output. (mathjax/MathJax#3526) --- ts/output/common.ts | 1 + ts/output/svg.ts | 6 +++++- ts/output/svg/Wrapper.ts | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ts/output/common.ts b/ts/output/common.ts index 2fe819740..5fc2ef288 100644 --- a/ts/output/common.ts +++ b/ts/output/common.ts @@ -645,6 +645,7 @@ export abstract class CommonOutputJax< if (!node) return; node.removeProperty('forcebreak'); node.removeProperty('breakable'); + node.coreMO().removeProperty('forcebreak'); if (node.getProperty('process-breaks')) { node.removeProperty('process-breaks'); for (const child of node.childNodes) { diff --git a/ts/output/svg.ts b/ts/output/svg.ts index c712059c1..63a0c12c3 100644 --- a/ts/output/svg.ts +++ b/ts/output/svg.ts @@ -141,7 +141,11 @@ export class SVG extends CommonOutputJax< * @override */ get forceInlineBreaks() { - return true; // We need to break up the output into several separate SVGs + // + // When inlinebreaks are enabled, we need to break up the output + // into several separate SVGs. + // + return this.options.linebreaks.inline; } /** diff --git a/ts/output/svg/Wrapper.ts b/ts/output/svg/Wrapper.ts index d6bd6a9ab..dc4980d94 100644 --- a/ts/output/svg/Wrapper.ts +++ b/ts/output/svg/Wrapper.ts @@ -155,7 +155,13 @@ export class SvgWrapper extends CommonWrapper< * @returns {boolean} True when embellished output is produced, false if not */ public toEmbellishedSVG(parents: N[]): boolean { - if (parents.length <= 1 || !this.node.isEmbellished) return false; + if ( + parents.length <= 1 || + !this.node.isEmbellished || + this.node.parent.isEmbellished + ) { + return false; + } const style = this.coreMO().embellishedBreakStyle; // // At the end of the first line or beginning of the second,