From dfbf2b4e304eb9c0663f66d6ec6d85b5dfdf8230 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 19 Jan 2017 09:49:47 -0800 Subject: [PATCH] Markdown.pl: retain square brackets around footnotes If the document contains footnote style links (e.g. [1], [2], [3] ...) they look much better formatted so as to retain the square brackets in the link text. Do this for any footnote style link text consisting of one to three digits. Signed-off-by: Kyle J. McKay --- Markdown.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Markdown.pl b/Markdown.pl index 88c1d74..c676961 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -851,6 +851,7 @@ sub _DoAnchors { $title =~ s!([*_~])!$g_escape_table{$1}!g; $result .= " title=\"$title\""; } + $link_text = '[' . $link_text . ']' if $link_text =~ /^\d{1,3}$/; $result .= ">$link_text"; } else { @@ -897,6 +898,7 @@ sub _DoAnchors { $result .= " title=\"$title\""; } + $link_text = '[' . $link_text . ']' if $link_text =~ /^\d{1,3}$/; $result .= ">$link_text"; $result; @@ -929,6 +931,7 @@ sub _DoAnchors { $title =~ s!([*_~])!$g_escape_table{$1}!g; $result .= " title=\"$title\""; } + $link_text = '[' . $link_text . ']' if $link_text =~ /^\d{1,3}$/; $result .= ">$link_text"; } else {