Skip to content

Commit 31ffd11

Browse files
committed
Clear forced inline breaks when switching between renderers, when needed
1 parent 4d1e195 commit 31ffd11

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

ts/output/common.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,18 @@ 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 (inlineMarked && (!makeBreaks || this.forceInlineBreaks !== math.root.getProperty('inlineForced'))) {
429+
this.unmarkInlineBreaks(math.root);
430+
math.root.removeProperty('inlineMarked');
431+
math.root.removeProperty('inlineForced');
432+
inlineMarked = false;
433+
}
434+
if (makeBreaks && !inlineMarked) {
428435
this.markInlineBreaks(math.root.childNodes?.[0]);
429436
math.root.setProperty('inlineMarked', true);
430-
} else if (!this.options.linebreaks.inline && inlineMarked) {
431-
this.unmarkInlineBreaks(math.root);
432-
math.root.setProperty('inlineMarked', false);
437+
math.root.setProperty('inlineForced', this.forceInlineBreaks);
433438
}
434439
math.root.setTeXclass(null);
435440
const wrapper = this.factory.wrap(math.root);

0 commit comments

Comments
 (0)