Skip to content

Commit c273b0a

Browse files
content: Support basic text styles for KaTeX content
This adds another experimental flag called `forceRenderKatex` which, if enabled, ignores any errors generated by the parser (like when encountering an unsupported CSS class) tries to do a "broken" render of the available span and their styles. Allowing the developer to test the different KaTeX content in the wild easily, while still in development.
1 parent 7609852 commit c273b0a

File tree

5 files changed

+701
-36
lines changed

5 files changed

+701
-36
lines changed

lib/model/content.dart

+4
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,14 @@ class MathBlockNode extends BlockContentNode {
365365

366366
class KatexNode extends ContentNode {
367367
const KatexNode({
368+
required this.styles,
368369
required this.text,
369370
required this.nodes,
370371
super.debugHtmlNode,
371372
}) : assert((text != null) ^ (nodes != null));
372373

374+
final KatexSpanStyles styles;
375+
373376
/// The text or a single character this KaTeX node contains, generally
374377
/// observed to be the leaf node in the KaTeX HTML tree.
375378
/// It will be null if [nodes] is non-null.
@@ -382,6 +385,7 @@ class KatexNode extends ContentNode {
382385
@override
383386
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
384387
super.debugFillProperties(properties);
388+
properties.add(KatexSpanStylesProperty('styles', styles));
385389
properties.add(StringProperty('text', text));
386390
}
387391

0 commit comments

Comments
 (0)