Skip to content

Commit cf21ba7

Browse files
committed
fix: adjust formula alignment to left after fixing BuildException
1 parent c2f13dd commit cf21ba7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,15 @@ class MathEquationBlockComponentWidgetState
141141

142142
String safeLatex(String raw) {
143143
if (raw.contains(r'\\') && !raw.contains(r'\begin{')) {
144-
return r'\begin{aligned}' + raw + r'\end{aligned}';
144+
final lines = raw.split(r'\\');
145+
final processedLines = lines.map((line) {
146+
final trimmed = line.trim();
147+
return trimmed.isEmpty ? '' : '& $trimmed';
148+
}).toList();
149+
150+
return r'\begin{aligned}' +
151+
processedLines.join(r' \\') +
152+
r'\end{aligned}';
145153
}
146154
return raw;
147155
}

0 commit comments

Comments
 (0)