stephenharris / WP-MarkDown

WP-MarkDown plug-in. Allows Markdown to be enabled in posts, comments and bbPress forums.
http://wordpress.org/extend/plugins/wp-markdown/
112 stars 19 forks source link

Images as links do not work #12

Closed stephenharris closed 11 years ago

stephenharris commented 11 years ago

As posted here http://wordpress.org/support/topic/close-but-not-polished?replies=3#post-4032749

[![Adobe Bucks][2]][1]

[1]: http://google.com/
[2]: http://google.com/logo.png

Causes the MarkDown to be corrupted and the following error:

Notice: Undefined index: linkID in /var/www/git/WP-MarkDown/markdownify/markdownify.php on line 412

The post previews fine so the problem lies in the HTML -> MarkDown converter.

stephenharris commented 11 years ago

Turns out MarkDownify messes up the stack - it assumes the last thing (link) pushed to the stack is the url of the link when parsing. So if you add additional tags to the stack (in this instance an image), it thinks this what the link should point to.

The stack contains other details - attributes, reference ID (1 and 2 in the above) - and this mix up causes the above error.

dwiel commented 11 years ago

This fixed it for me. Thanks!