Skip to content

Commit

Permalink
chore: update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
xushengs committed Feb 7, 2024
1 parent cfed0c9 commit 0ea95fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/src/latex_block_syntax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ class LatexBlockSyntax extends BlockSyntax {
@override
List<Line> parseChildLines(BlockParser parser) {
final m = pattern.firstMatch(parser.current.content);
if (m == null) {
return [];
}
if (m[2] != null) {
if (m?[2] != null) {
parser.advance();
return [Line(m[2] ?? '')];
return [Line(m?[2] ?? '')];
}

final childLines = <Line>[];
parser.advance();

Expand Down
10 changes: 9 additions & 1 deletion test/flutter_markdown_latex_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ this is latex: **pi:** \$\$\\pi\$\$ **theta:** \$\$\\theta\$\$
\$\$
\\theta
\$\$
'''
''',
'OpenAI inline latex': '''
OpenAI inline latex \\( f(x) = \\sum_{i=0}^{n} \\frac{a_i}{1+x} \\)
''',
'OpenAI block latex': '''
OpenAI block latex:
\\[ c = \\pm\\sqrt{a^2 + b^2} \\]
''',
};

void main() {
Expand Down
Binary file added test/goldens/OpenAI block latex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/goldens/OpenAI inline latex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0ea95fc

Please sign in to comment.