Skip to content

Commit 919caac

Browse files
authored
Merge pull request #1436 from mathjax/fix/svg-inline-breaks
Fix inline linebreaking issues with SVG output. (mathjax/MathJax#3526)
2 parents c59285a + 0f3663e commit 919caac

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

ts/output/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ export abstract class CommonOutputJax<
645645
if (!node) return;
646646
node.removeProperty('forcebreak');
647647
node.removeProperty('breakable');
648+
node.coreMO().removeProperty('forcebreak');
648649
if (node.getProperty('process-breaks')) {
649650
node.removeProperty('process-breaks');
650651
for (const child of node.childNodes) {

ts/output/svg.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,11 @@ export class SVG<N, T, D> extends CommonOutputJax<
141141
* @override
142142
*/
143143
get forceInlineBreaks() {
144-
return true; // We need to break up the output into several separate SVGs
144+
//
145+
// When inlinebreaks are enabled, we need to break up the output
146+
// into several separate SVGs.
147+
//
148+
return this.options.linebreaks.inline;
145149
}
146150

147151
/**

ts/output/svg/Wrapper.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,13 @@ export class SvgWrapper<N, T, D> extends CommonWrapper<
155155
* @returns {boolean} True when embellished output is produced, false if not
156156
*/
157157
public toEmbellishedSVG(parents: N[]): boolean {
158-
if (parents.length <= 1 || !this.node.isEmbellished) return false;
158+
if (
159+
parents.length <= 1 ||
160+
!this.node.isEmbellished ||
161+
this.node.parent.isEmbellished
162+
) {
163+
return false;
164+
}
159165
const style = this.coreMO().embellishedBreakStyle;
160166
//
161167
// At the end of the first line or beginning of the second,

0 commit comments

Comments
 (0)