Browse Source

Markdown.pl: improve XML comment parsing

Use the actual XML comment rule for parsing XML comments.

The leading delimiter is fixed as "<!--" and the trailing delimiter
is fixed as "-->".

In between the leading and trailing delimiters any characters other
than a "-" may be used and a "-" may be used provided it's followed
immediately with a non-"-" character.

Now that the clear beginning and end of comments can be properly
identified, there no longer needs to be a blank line following the
comment -- the end delimiter serves quite unambiguously.  Relax the
ending match to just be end of line or end of document.

This makes comments parse much more like they're expected to.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 6 years ago
parent
commit
d87f4abdb1
  1. 8
      Markdown.pl

8
Markdown.pl

@ -662,12 +662,12 @@ sub _HashHTMLBlocks {
( # save in $1
[ ]{0,$less_than_indent}
(?s:
<!
(--.*?--\s*)+
>
<!--
(?:[^-]|(?:-(?!-)))*
-->
)
[ ]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
(?=\n{1,}|\Z) # followed by end of line or end of document
)
}{
my $key = block_id($1);

Loading…
Cancel
Save