diff --git a/lib/src/utils/markdown.dart b/lib/src/utils/markdown.dart index bae521d5..2a4c1437 100644 --- a/lib/src/utils/markdown.dart +++ b/lib/src/utils/markdown.dart @@ -212,7 +212,13 @@ String markdown( bool convertLinebreaks = true, }) { var ret = markdownToHtml( - text.replaceNewlines(), + text + .replaceAllMapped( + // Replace HTML tags + RegExp(r'<([^>]*)>'), + (match) => '<${match.group(1)}>', + ) + .replaceNewlines(), extensionSet: ExtensionSet.gitHubFlavored, blockSyntaxes: [ BlockLatexSyntax(), diff --git a/test/markdown_test.dart b/test/markdown_test.dart index ac3ae2f0..7b946fef 100644 --- a/test/markdown_test.dart +++ b/test/markdown_test.dart @@ -220,6 +220,10 @@ void main() { ), '

The first
codeblock

void main(){\nprint(something);\n}\n

And the second code block

meow\nmeow\n
', ); + expect( + markdown('Test *unescaped*'), + 'Test <m> unescaped', + ); }); test('Checkboxes', () { expect(