From 31ffd11288fb80cd72aa3a61302e70cd59927d1b Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 2 Jul 2025 10:44:24 -0400 Subject: [PATCH 1/2] Clear forced inline breaks when switching between renderers, when needed --- ts/output/common.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ts/output/common.ts b/ts/output/common.ts index dc95812a5..5aa675a3d 100644 --- a/ts/output/common.ts +++ b/ts/output/common.ts @@ -423,13 +423,18 @@ export abstract class CommonOutputJax< if (linebreak) { this.getLinebreakWidth(); } - const inlineMarked = !!math.root.getProperty('inlineMarked'); - if (this.options.linebreaks.inline && !math.display && !inlineMarked) { + const makeBreaks = this.options.linebreaks.inline && !math.display; + let inlineMarked = !!math.root.getProperty('inlineMarked'); + if (inlineMarked && (!makeBreaks || this.forceInlineBreaks !== math.root.getProperty('inlineForced'))) { + this.unmarkInlineBreaks(math.root); + math.root.removeProperty('inlineMarked'); + math.root.removeProperty('inlineForced'); + inlineMarked = false; + } + if (makeBreaks && !inlineMarked) { this.markInlineBreaks(math.root.childNodes?.[0]); math.root.setProperty('inlineMarked', true); - } else if (!this.options.linebreaks.inline && inlineMarked) { - this.unmarkInlineBreaks(math.root); - math.root.setProperty('inlineMarked', false); + math.root.setProperty('inlineForced', this.forceInlineBreaks); } math.root.setTeXclass(null); const wrapper = this.factory.wrap(math.root); From d55b576ded607c1d2ffccc6b043ec88a42e52d19 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 9 Jul 2025 16:26:38 -0400 Subject: [PATCH 2/2] Fix formatting --- ts/output/common.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ts/output/common.ts b/ts/output/common.ts index 5aa675a3d..211c526fa 100644 --- a/ts/output/common.ts +++ b/ts/output/common.ts @@ -425,7 +425,11 @@ export abstract class CommonOutputJax< } const makeBreaks = this.options.linebreaks.inline && !math.display; let inlineMarked = !!math.root.getProperty('inlineMarked'); - if (inlineMarked && (!makeBreaks || this.forceInlineBreaks !== math.root.getProperty('inlineForced'))) { + if ( + inlineMarked && + (!makeBreaks || + this.forceInlineBreaks !== math.root.getProperty('inlineForced')) + ) { this.unmarkInlineBreaks(math.root); math.root.removeProperty('inlineMarked'); math.root.removeProperty('inlineForced');