Skip to content

Commit

Permalink
fix: close #275
Browse files Browse the repository at this point in the history
  • Loading branch information
lucien144 committed Feb 11, 2022
1 parent 8893a25 commit 26dbf0e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/components/post/PostHtml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,15 @@ class PostHtml extends StatelessWidget {
) {
final element = renderContext.tree.element;

if (element!.attributes['style'] == 'background-color:#272822') {
if (element == null) {
return parsedChild;
}

if (element.attributes['style'] == 'background-color:#272822') {
final source = HtmlUnescape().convert(element.text);
return SyntaxHighlighter(source);
} else {
return parsedChild;
return Text(element.text, style: TextStyle(fontFamily: 'JetBrainsMono'));
}
}
},
Expand Down

0 comments on commit 26dbf0e

Please sign in to comment.