From b39fb9b4bc542744b21044d22e19b7f539d20b5b Mon Sep 17 00:00:00 2001 From: Michel Fortin Date: Sun, 4 May 2014 21:30:14 -0400 Subject: [PATCH] Hack to fix `[link]()`. Fixes #80. --- Michelf/Markdown.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Michelf/Markdown.php b/Michelf/Markdown.php index 096b985..25b903f 100644 --- a/Michelf/Markdown.php +++ b/Michelf/Markdown.php @@ -617,6 +617,12 @@ class Markdown implements MarkdownInterface { $url = $matches[3] == '' ? $matches[4] : $matches[3]; $title =& $matches[7]; + // if the URL was of the form it got caught by the HTML + // tag parser and hashed. Need to reverse the process before using the URL. + $unhashed = $this->unhash($url); + if ($unhashed != $url) + $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); + $url = $this->encodeAttribute($url); $result = "doExtraAttributes("a", $dummy =& $matches[8]); + // if the URL was of the form it got caught by the HTML + // tag parser and hashed. Need to reverse the process before using the URL. + $unhashed = $this->unhash($url); + if ($unhashed != $url) + $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); $url = $this->encodeAttribute($url);