Skip to content

Refactor parts of initial KaTeX handling #1478

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 12 commits into from
Apr 25, 2025
Merged
32 changes: 13 additions & 19 deletions lib/model/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ class CodeBlockSpanNode extends ContentNode {
}
}

class MathBlockNode extends BlockContentNode {
const MathBlockNode({
abstract class MathNode extends ContentNode {
const MathNode({
super.debugHtmlNode,
required this.texSource,
required this.nodes,
Expand Down Expand Up @@ -402,6 +402,14 @@ class KatexNode extends ContentNode {
}
}

class MathBlockNode extends MathNode implements BlockContentNode {
const MathBlockNode({
super.debugHtmlNode,
required super.texSource,
required super.nodes,
});
}

class ImageNodeList extends BlockContentNode {
const ImageNodeList(this.images, {super.debugHtmlNode});

Expand Down Expand Up @@ -863,26 +871,12 @@ class ImageEmojiNode extends EmojiNode {
}
}

class MathInlineNode extends InlineContentNode {
class MathInlineNode extends MathNode implements InlineContentNode {
const MathInlineNode({
super.debugHtmlNode,
required this.texSource,
required this.nodes,
required super.texSource,
required super.nodes,
});

final String texSource;
final List<KatexNode>? nodes;

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(StringProperty('texSource', texSource));
}

@override
List<DiagnosticsNode> debugDescribeChildren() {
return nodes?.map((node) => node.toDiagnosticsNode()).toList() ?? const [];
}
}

class GlobalTimeNode extends InlineContentNode {
Expand Down
Loading