links not translated in markdown processed block level elements #11

Open
BrianMowrey opened this Issue Apr 15, 2011 · 0 comments

1 participant

@BrianMowrey

When you have a block level element with the markdown attribute set it does not translate the markdown links to html links.

e.g.

<div class="someclass" markdown="1">
[Google][1]
</div>
[1]: http://www.google.ca     

Does not translate properly.
This is because it is hashing the html blocks before it is grabbing the link definitions, if you strip the link definitions first then it works properly. I'm not sure if this would cause other issues (maybe stripping something out that looks like a link reference that is in a block level element that is not markdown processed? It seems okay in our testing so far.

patch (I hope the formatting doesn't get too messed up):

--- a/Markdown.pm       2011-04-15 14:29:44.794861807 -0500
+++ b/Markdown.pm       2011-04-15 14:29:50.848690220 -0500
@@ -232,11 +232,11 @@

$text = $self->_CleanUpDoc($text);

+    $text = $self->_StripLinkDefinitions($text);
+    
     # Turn block-level HTML elements into hash entries, and interpret markdown in them if they have a 'markdown="1"' attribute
     $text = $self->_HashHTMLBlocks($text, {interpret_markdown_on_attribute => 1});

-    $text = $self->_StripLinkDefinitions($text);
-
     $text = $self->_RunBlockGamut($text, {wrap_in_p_tags => 1});

     $text = $self->_UnescapeSpecialChars($text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment