Update clearHtmlCommentText helper to match CommonMark (instead of HTML) specification (refs #361).

This commit is contained in:
David Anson 2021-01-30 13:08:57 -08:00
parent 6f39df1417
commit c4e236b858
6 changed files with 148 additions and 48 deletions

65
test/html-comments.md Normal file
View file

@ -0,0 +1,65 @@
# HTML Comments
## Block Comments
<https://spec.commonmark.org/0.29/#html-blocks>
<!-- *comment * -->
<!-- *comment * -->text
<!-- *comment * -->
<!-- *code * -->
<!-- *comment *
*comment * -->
<!-- *comment *
*comment *
*comment * -->
<!--> *{MD037} * -->
<!---> *{MD037} * -->
<!-- *comment * --->
<!-- -- *comment * -->
<!-- *comment * -- -->
## Inline Comments
<https://spec.commonmark.org/0.29/#html-comment>
t<!-- *comment * -->
t<!-- *comment * -->text
t<!-- *comment * -->
t<!-- *code * -->
t<!-- *comment *
*comment * -->
t<!-- *comment *
*comment *
*comment * -->
t<!--> *{MD037} * -->
t<!---> *{MD037} * -->
t<!-- *{MD037} * --->
t<!-- -- *{MD037} * -->
t<!-- *{MD037} * -- -->
## Notes
It's important that the rule used above is one that calls
`helpers.forEachLine` so `markdown-it` doesn't ignore any
incorrectly-remaining comment blocks.