Skip to content

Commit 3fc3801

Browse files
authored
Merge pull request #1293 from mathjax/fix/inline-breaks
Clear forced inline breaks when switching between renderers, when needed
2 parents 76a6509 + d55b576 commit 3fc3801

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

ts/output/common.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,22 @@ export abstract class CommonOutputJax<
423423
if (linebreak) {
424424
this.getLinebreakWidth();
425425
}
426-
const inlineMarked = !!math.root.getProperty('inlineMarked');
427-
if (this.options.linebreaks.inline && !math.display && !inlineMarked) {
426+
const makeBreaks = this.options.linebreaks.inline && !math.display;
427+
let inlineMarked = !!math.root.getProperty('inlineMarked');
428+
if (
429+
inlineMarked &&
430+
(!makeBreaks ||
431+
this.forceInlineBreaks !== math.root.getProperty('inlineForced'))
432+
) {
433+
this.unmarkInlineBreaks(math.root);
434+
math.root.removeProperty('inlineMarked');
435+
math.root.removeProperty('inlineForced');
436+
inlineMarked = false;
437+
}
438+
if (makeBreaks && !inlineMarked) {
428439
this.markInlineBreaks(math.root.childNodes?.[0]);
429440
math.root.setProperty('inlineMarked', true);
430-
} else if (!this.options.linebreaks.inline && inlineMarked) {
431-
this.unmarkInlineBreaks(math.root);
432-
math.root.setProperty('inlineMarked', false);
441+
math.root.setProperty('inlineForced', this.forceInlineBreaks);
433442
}
434443
math.root.setTeXclass(null);
435444
const wrapper = this.factory.wrap(math.root);

0 commit comments

Comments
 (0)