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

Code fragment like to markup language in code block modifed when saved #23

Closed reshout closed 11 years ago

reshout commented 11 years ago
 server.send({
    text: text,
    from: "xxx <xxx@gmail.com>",
    to: "xxx <xxx@gmail.com>",
    subject: "xxx"
  }, function(err, message) {
    console.log(err || message);
  });

WP-MarkDown modify this code as follows:

 server.send({
    text: text,
    from: "xxx <xxx @gmail.com>",
    to: "xxx </xxx><xxx @gmail.com>",
    subject: "xxx"
  }, function(err, message) {
    console.log(err || message);
  });</xxx>
stephenharris commented 11 years ago

Can't reproduce this but looks like its trying to 'balance tags'.

On a related note I've noticed that the "tags" <xxx> are removed if you're a non-admin. This is because post content sanitisation (including stripping of disallowed tags) occurs before content is converted to HTML.

Similarly balanceTags() is also used before the content is converted to HTML - which would explain the above bug - but I'm not why I'm unable to reproduce it.

Are you posting the above as admin/author?

reshout commented 11 years ago

Yes, I posted the following article as an administrator.

http://www.reshout.com/?p=385

Instead of being removed, closing tags </reshout> are appended.

Is it possible to avoid applying balncedTags() on the text in a code block?

stephenharris commented 11 years ago

Something similar to the fix for non-admins above should work for the balanceTags() issue. I'll push an update here later today - if you could test it out that would be grand :).

reshout commented 11 years ago

After applying 2debb2b, the problem is resolved. Thanks for quick response.

stephenharris commented 11 years ago

Awesome, no problem :)