Correctly escape & in inline image titles
diff --git a/pkgs/markdown/CHANGELOG.md b/pkgs/markdown/CHANGELOG.md index d4ace80..89e2377 100644 --- a/pkgs/markdown/CHANGELOG.md +++ b/pkgs/markdown/CHANGELOG.md
@@ -2,6 +2,7 @@ * Render element attributes in the order they were defined. Aligns more closely with the strict spec definition. +* Correctly render `&` within inline image titles. * Added 68 new GitHub emojis. ## 2.0.2
diff --git a/pkgs/markdown/lib/src/inline_parser.dart b/pkgs/markdown/lib/src/inline_parser.dart index c03cd8a..b7e0c0c 100644 --- a/pkgs/markdown/lib/src/inline_parser.dart +++ b/pkgs/markdown/lib/src/inline_parser.dart
@@ -1008,7 +1008,8 @@ element.attributes['src'] = escapeHtml(destination); element.attributes['alt'] = state?.textContent ?? ''; if (title != null && title.isNotEmpty) { - element.attributes['title'] = escapeAttribute(title); + element.attributes['title'] = + escapeAttribute(title.replaceAll('&', '&')); } return element; }
diff --git a/pkgs/markdown/tool/common_mark_stats.json b/pkgs/markdown/tool/common_mark_stats.json index 5949d7b..cfeeb8a 100644 --- a/pkgs/markdown/tool/common_mark_stats.json +++ b/pkgs/markdown/tool/common_mark_stats.json
@@ -342,11 +342,11 @@ }, "Images": { "543": "strict", - "544": "loose", + "544": "strict", "545": "fail", "546": "strict", - "547": "loose", - "548": "loose", + "547": "strict", + "548": "strict", "549": "strict", "550": "strict", "551": "strict",
diff --git a/pkgs/markdown/tool/gfm_stats.json b/pkgs/markdown/tool/gfm_stats.json index aae6a73..3f2cc1e 100644 --- a/pkgs/markdown/tool/gfm_stats.json +++ b/pkgs/markdown/tool/gfm_stats.json
@@ -363,11 +363,11 @@ }, "Images": { "563": "strict", - "564": "loose", + "564": "strict", "565": "fail", "566": "strict", - "567": "loose", - "568": "loose", + "567": "strict", + "568": "strict", "569": "strict", "570": "strict", "571": "strict",