Update HTML comment scanner...

to accord with commonmark/commonmark-spec#713.
This commit is contained in:
John MacFarlane 2022-09-08 10:05:46 -07:00
parent 9c1922e117
commit 3dfe48d6bf
2 changed files with 3 additions and 3 deletions

View File

@ -908,9 +908,9 @@ static cmark_node *handle_pointy_brace(subject *subj, int options) {
if (c == '!') {
c = subj->input.data[subj->pos+1];
if (c == '-') {
matchlen = scan_html_comment(&subj->input, subj->pos + 2);
matchlen = scan_html_comment(&subj->input, subj->pos + 1);
if (matchlen > 0)
matchlen += 2; // prefix "<-"
matchlen += 1; // prefix "<!"
} else if (c == '[') {
if ((subj->flags & FLAG_SKIP_HTML_CDATA) == 0) {
matchlen = scan_html_cdata(&subj->input, subj->pos + 2);

View File

@ -54,7 +54,7 @@ bufsize_t _scan_at(bufsize_t (*scanner)(const unsigned char *), cmark_chunk *c,
opentag = tagname attribute* spacechar* [/]? [>];
closetag = [/] tagname spacechar* [>];
htmlcomment = "--->" | ("-" ([-]? [^\x00>-]) ([-]? [^\x00-])* "-->");
htmlcomment = "-->" | "--->" | "--" ([^\x00-]+ | "-" [^\x00-] | "--" [^\x00>])+ "-->";
processinginstruction = ([^?>\x00]+ | [?][^>\x00] | [>])+;