Skip to content

Commit 09f2bbe

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 2b910d5 commit 09f2bbe

File tree

6 files changed

+769
-39
lines changed

6 files changed

+769
-39
lines changed

lib/model/content.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,14 @@ class MathBlockNode extends BlockContentNode {
371371

372372
class KatexNode extends ContentNode {
373373
const KatexNode({
374+
required this.styles,
374375
required this.text,
375376
required this.nodes,
376377
super.debugHtmlNode,
377378
}) : assert((text != null) ^ (nodes != null));
378379

380+
final KatexSpanStyles styles;
381+
379382
/// The text this KaTeX node contains, generally
380383
/// observed to be the leaf node in the KaTeX HTML tree.
381384
///
@@ -390,6 +393,7 @@ class KatexNode extends ContentNode {
390393
@override
391394
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
392395
super.debugFillProperties(properties);
396+
properties.add(DiagnosticsProperty<KatexSpanStyles>('styles', styles));
393397
properties.add(StringProperty('text', text));
394398
}
395399

0 commit comments

Comments
 (0)