From 4be5dfd8e30c4d438699eeb96883b7973a975716 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 21 Nov 2019 14:22:15 -0700 Subject: [PATCH] Markdown.pl: improve atx-style header handling Treat more than 6 consecutive '#'s as not a header. Allow blank headers to be recognized which can be used for spacers and/or formatting breaks. Signed-off-by: Kyle J. McKay --- Markdown.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Markdown.pl b/Markdown.pl index a6391fb..cfc6c17 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -1364,7 +1364,7 @@ sub _MakeAnchorId { sub _GetNewAnchorId { my $link = _strip(lc(shift)); - return '' if defined($g_anchors{$link}); + return '' if $link eq "" || defined($g_anchors{$link}); my $id = _MakeAnchorId($link); return '' unless $id; $g_anchors{$link} = '#'.$id; @@ -1444,15 +1444,16 @@ sub _DoHeaders { $text =~ s{ ^(\#{1,6}) # $1 = string of #'s [ ]* - (.+?) # $2 = Header text + ((?:(?:(?" . _RunSpanGamut($h) . "\n\n"; }egmx;