Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/inlines.c
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ static cmark_node *handle_pointy_brace(subject *subj, int options) {
// finally, try to match an html tag
if (subj->pos + 2 <= subj->input.len) {
int c = subj->input.data[subj->pos];
if (c == '!' && (subj->flags & FLAG_SKIP_HTML_COMMENT) == 0) {
if (c == '!') {
c = subj->input.data[subj->pos+1];
if (c == '-' && subj->input.data[subj->pos+2] == '-') {
if (subj->pos + 3 < subj->input.len &&
Expand All @@ -941,7 +941,7 @@ static cmark_node *handle_pointy_brace(subject *subj, int options) {
subj->input.data[subj->pos+3] == '-' &&
subj->input.data[subj->pos+4] == '>') {
matchlen = 5;
} else {
} else if ((subj->flags & FLAG_SKIP_HTML_COMMENT) == 0) {
matchlen = scan_html_comment(&subj->input, subj->pos + 1);
if (matchlen > 0) {
matchlen += 1; // prefix "<"
Expand Down
8 changes: 8 additions & 0 deletions test/regression.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,14 @@ x <!A>
<p>x <!A></p>
````````````````````````````````

An unclosed HTML comment must not stop later declarations and CDATA
sections from being recognized as raw HTML.
```````````````````````````````` example
a <!-- x <!B> <![CDATA[y]]> c
.
<p>a &lt;!-- x <!B> <![CDATA[y]]> c</p>
````````````````````````````````

An underscore that is not part of a delimiter should not prevent another
pair of underscores from forming part of their own.
```````````````````````````````` example
Expand Down
Loading