Skip to content

Commit a68e779

Browse files
committed
fix: fix #7949 Latex BuildException
1 parent cc572f3 commit a68e779

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ class MathEquationBlockComponentWidgetState
138138
child: _build(context),
139139
);
140140
}
141+
142+
String _safeLatex(String raw) {
143+
if (raw.contains(r'\\') && !raw.contains(r'\begin{')) {
144+
return r'\begin{aligned}' + raw + r'\end{aligned}';
145+
}
146+
return raw;
147+
}
141148

142149
Widget _build(BuildContext context) {
143150
Widget child = Container(
@@ -222,12 +229,7 @@ class MathEquationBlockComponentWidgetState
222229
}
223230

224231
Widget _buildMathEquation(BuildContext context) {
225-
String _safeLatex(String raw) {
226-
if (raw.contains(r'\\') && !raw.contains(r'\begin{')) {
227-
return r'\begin{aligned}' + raw + r'\end{aligned}';
228-
}
229-
return raw;
230-
}
232+
231233
return Center(
232234
child: Math.tex(
233235
_safeLatex(formula),

0 commit comments

Comments
 (0)