markdown without its HTML comments; fenced code keeps them.
markdown
String withoutHtmlComments(String markdown) => markdown.replaceAllMapped(_fenceOrComment, (Match m) => m[1] ?? '');