From b7f3fc1c556138a342d760072609abea93f87469 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Mon, 9 Jan 2017 19:21:42 -0800 Subject: [PATCH] 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 --- Markdown.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Markdown.pl b/Markdown.pl index 790094a..8cdb8f8 100755 --- a/Markdown.pl +++ b/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]+