Skip to content

Clear forced inline breaks when switching between renderers, when needed #1293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions ts/output/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,22 @@
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) {

Check warning on line 438 in ts/output/common.ts

View check run for this annotation

Codecov / codecov/patch

ts/output/common.ts#L426-L438

Added lines #L426 - L438 were not covered by tests
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);

Check warning on line 441 in ts/output/common.ts

View check run for this annotation

Codecov / codecov/patch

ts/output/common.ts#L441

Added line #L441 was not covered by tests
}
math.root.setTeXclass(null);
const wrapper = this.factory.wrap(math.root);
Expand Down