From 6c05ea2380e5ad2410018c5c6b4c7bfcc270acee Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Wed, 22 Jul 2026 07:56:01 -0700 Subject: [PATCH 1/2] Respect enableTagfilter when inlineOnly is passed --- pkgs/markdown/CHANGELOG.md | 2 ++ pkgs/markdown/lib/src/html_renderer.dart | 7 ++++++- pkgs/markdown/test/markdown_test.dart | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/markdown/CHANGELOG.md b/pkgs/markdown/CHANGELOG.md index 466be8339b..f9125ebd9c 100644 --- a/pkgs/markdown/CHANGELOG.md +++ b/pkgs/markdown/CHANGELOG.md @@ -6,6 +6,8 @@ so that the created link can contain that content. * For testing the package, adds matchers for `Element` and `Text` to more directly test the output parsing. +* Fix a bug such that `markdownToHtml`, when given `inlineOnly: true`, will now + respect `enableTagfilter: true`. ## 7.3.1 diff --git a/pkgs/markdown/lib/src/html_renderer.dart b/pkgs/markdown/lib/src/html_renderer.dart index ca55edd316..5b6022759b 100644 --- a/pkgs/markdown/lib/src/html_renderer.dart +++ b/pkgs/markdown/lib/src/html_renderer.dart @@ -39,7 +39,12 @@ String markdownToHtml( withDefaultInlineSyntaxes: withDefaultInlineSyntaxes, ); - if (inlineOnly) return renderToHtml(document.parseInline(markdown)); + if (inlineOnly) { + return renderToHtml( + document.parseInline(markdown), + enableTagfilter: enableTagfilter, + ); + } final nodes = document.parse(markdown); diff --git a/pkgs/markdown/test/markdown_test.dart b/pkgs/markdown/test/markdown_test.dart index 64092ebe04..7870661248 100644 --- a/pkgs/markdown/test/markdown_test.dart +++ b/pkgs/markdown/test/markdown_test.dart @@ -434,6 +434,13 @@ nyan''', ''', inlineOnly: true, ); + validateCore( + 'filters disallowed html tags when enableTagfilter is true', + 'foo bar', + 'foo <title> bar', + inlineOnly: true, + enableTagfilter: true, + ); }); group('ExtensionSet', () { From 1372936f1c08335b298df0bfc66a0e2bfc05cdee Mon Sep 17 00:00:00 2001 From: Sam Rawlins <srawlins@google.com> Date: Wed, 22 Jul 2026 08:01:16 -0700 Subject: [PATCH 2/2] changelog --- pkgs/markdown/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/markdown/CHANGELOG.md b/pkgs/markdown/CHANGELOG.md index f9125ebd9c..387cdacd8e 100644 --- a/pkgs/markdown/CHANGELOG.md +++ b/pkgs/markdown/CHANGELOG.md @@ -6,8 +6,8 @@ so that the created link can contain that content. * For testing the package, adds matchers for `Element` and `Text` to more directly test the output parsing. -* Fix a bug such that `markdownToHtml`, when given `inlineOnly: true`, will now - respect `enableTagfilter: true`. +* Fixes an issue such that `markdownToHtml`, when given `inlineOnly: true`, + now respects `enableTagfilter: true`. ## 7.3.1