From f2701d56385b5856f56f69bc9b185d974853e430 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 27 Dec 2017 06:47:29 -0800 Subject: [PATCH] Markdown.pl: apply -i and -r options to a and img tags When a and img tags are generated using the normal Markdown syntax any prefixes specified with the -i and -r options are inserted as appropriate. Extend this processing to explicit a and img tags as well. This makes sense because they should be handled the same way the Markdown syntax generated tags are for consistency. It's still possible to "escape" from the prefixes by using an explicit scheme+host+port or the commonly supported (but not a standard) //+host+port mechanism. And it only matters if prefixes have been set with the -i and/or -r options (the default is no prefixes) anyway. Signed-off-by: Kyle J. McKay --- Markdown.pl | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Markdown.pl b/Markdown.pl index 381d7a1..edfc74a 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -1979,6 +1979,8 @@ sub _DoTag { if (($tag =~ m{^<($g_possible_tag_name)(?:[\s>]|/>$)} || $tag =~ m{^}) && $ok_tag_name{lc($1)}) { + return _ProcessURLTag("href", $tag) if $tag =~ /^/>/g; + + return $text; +} + + sub _EncodeAmps { my $text = shift;