Skip to content

Commit 99874fa

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 2f2e1d9 commit 99874fa

File tree

6 files changed

+769
-39
lines changed

6 files changed

+769
-39
lines changed

lib/model/content.dart

+4
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.
380383
///
381384
/// It will be null if [nodes] is non-null.
@@ -389,6 +392,7 @@ class KatexNode extends ContentNode {
389392
@override
390393
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
391394
super.debugFillProperties(properties);
395+
properties.add(DiagnosticsProperty<KatexSpanStyles>('styles', styles));
392396
properties.add(StringProperty('text', text));
393397
}
394398

0 commit comments

Comments
 (0)