WordPress.org

Forums

WP-Markdown
[resolved] Greater than (>) is incorrectly encoded (8 posts)

  1. borekb
    Member
    Posted 3 years ago #

    Hi, WP Markdown is a great and useful plugin, I've just encountered one minor issue with it. When visitor writes this into their comment:

    (backticks)dibi::update('users', $_POST)->where(...)->execute();(backtics)

    It will be displayed as

    dibi::update('users', $_POST)->where(...)->execute();

    Instead of greater than sign (>), WP Markdown outputs "&gt" which is displayed as "&gt" in the browser. Any hint on how to fix this?

    http://wordpress.org/extend/plugins/wp-markdown/

  2. borekb
    Member
    Posted 3 years ago #

    Sorry the last sentence should read:

    Instead of greater than sign (>), WP Markdown outputs &gt (in case WordPress.org eats this, there is an "amp" HTML entity) which is displayed as &gt in the browser. Any hint on how to fix this?

  3. borekb
    Member
    Posted 3 years ago #

    Sorry I've noticed that this forum screwed my original post in one more way, there should be "gt" entities in the output example, not PHP arrows.

  4. Stephen Harris
    Member
    Plugin Author

    Posted 3 years ago #

    Again - I've tested this and it works fine form. Chances are that the root cause is also the cause of your other bug report.

    Same advice as before I'm afraid. On a fresh install of WordPress with TwentyEleven theme there is no issue. It's a pain but if you deactivate your theme and plug-ins and re-activate theme one by one until the problem reoccurs that will identify the culprit.

  5. borekb
    Member
    Posted 3 years ago #

    Maybe could you suggest a hook / action I should look for in other plugins to see if something interferes with WP-Markdown?

  6. Stephen Harris
    Member
    Plugin Author

    Posted 3 years ago #

    Borekb
    Apologies. I did a few more tests - the problem is because logged out users cannot post html, and this is usually stripped out with wp_kses, which, in this instance, runs when a comment is saved. The Markdown parser is hooked onto the same filter, but is running after wp_kses as stripped out any html (like the >). Changing the priority so that the Markdown is parsed first solves the problem, and the other related bug report.

    I shall update plug-in at some point, but if you wish to fix it yourself in the meantime, line 67 of the wp-markdown.php should read:
    add_filter('pre_comment_content',array($this,'pre_comment_content'),5);
    (note the 5)

  7. dracan
    Member
    Posted 2 years ago #

    Hi. I don't know if this is a related issue or not, but I'm also having trouble with the greater and less than characters in posts.

    I tend to write my posts in a markdown text editor, then paste into WordPress when I'm done.

    Here are steps to reproduce my issue:

    1. Paste markdown into the WordPress post editor (where Markdown contains greater-than and less-than characters written in HTML entity form).

    2. Click on 'Save draft'. Notice that all my greater-than and less-than HTML entities have been replaced with a real greater-than or less-than symbol, which then stops them from rendering when I do a preview.

    Other than this issue - well done on an awesome plugin though! Very very useful! :)

  8. Stephen Harris
    Member
    Plugin Author

    Posted 2 years ago #

    The > and < symbols display correctly for me. If you want to display, and not render HTML, then you can enclose it in backtics, or put it on a separate line and indent by 4 or more spaces.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Markdown
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic