From f3bb654ac2cda19bdd8a35fb46846018acd01a89 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sat, 10 May 2025 15:45:31 +0200 Subject: [PATCH] feat: Switch to github flavor markdown to render checkboxes Also fixes a bug where a room pill was not rendered as link. --- lib/src/utils/markdown.dart | 2 +- test/markdown_test.dart | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/src/utils/markdown.dart b/lib/src/utils/markdown.dart index 7f1f599f..bae521d5 100644 --- a/lib/src/utils/markdown.dart +++ b/lib/src/utils/markdown.dart @@ -213,7 +213,7 @@ String markdown( }) { var ret = markdownToHtml( text.replaceNewlines(), - extensionSet: ExtensionSet.commonMark, + extensionSet: ExtensionSet.gitHubFlavored, blockSyntaxes: [ BlockLatexSyntax(), ], diff --git a/test/markdown_test.dart b/test/markdown_test.dart index 12c7b2fa..ac3ae2f0 100644 --- a/test/markdown_test.dart +++ b/test/markdown_test.dart @@ -141,7 +141,7 @@ void main() { ); expect( markdown('https://matrix.to/#/#fox:sorunome.de'), - 'https://matrix.to/#/#fox:sorunome.de', + 'https://matrix.to/#/#fox:sorunome.de', ); expect( markdown('Hey @sorunome:sorunome.de:1234!'), @@ -221,5 +221,14 @@ void main() { '

The first
codeblock

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

And the second code block

meow\nmeow\n
', ); }); + test('Checkboxes', () { + expect( + markdown( + '- [ ] Check 1\n- [x] Check 2\n- Normal list item', + convertLinebreaks: true, + ), + '', + ); + }); }); }