Browse Source

Markdown.pl: do not mishandle double list markers

This example:

  * a
      + 1. x
      + 2. y
  * c

Should format as one outer "ul" with the first item having
a second inner "ul".  There should not be any "ol" lists in
the formatted result at all.

Correct the code so that it does not think "+ 1. x" not only
starts a list but also includes a sublist.

Now it only starts a list where the first item just happens to
have content that closely resembles a list marker.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 7 years ago
parent
commit
b7f3fc1c55
  1. 3
      Markdown.pl

3
Markdown.pl

@ -373,7 +373,7 @@ sub Markdown {
# Strip link definitions, store in hashes.
$text = _StripLinkDefinitions($text);
$text = _RunBlockGamut($text);
$text = _RunBlockGamut("\n".$text);
# Unhashify code blocks
$text =~ s/(\005\d+\006)/$g_code_blocks{$1}/g;
@ -936,6 +936,7 @@ sub _DoLists {
my $whole_list = qr{
( # $1 = whole list
( # $2
(?<=\n)
[ ]{0,$less_than_indent}
(${marker_any}) # $3 = first list item marker
[ \t]+

Loading…
Cancel
Save