WordPress.org

Ready to get started?Download WordPress

Forums

WP SyntaxHighlighter
html entity inside post-content (7 posts)

  1. Hiranthi
    Member
    Posted 2 years ago #

    I'm not sure when this started, but for some reason WP SyntaxHighligter is transforming the > ' < & charachters to &gt ; etc. When I disable the plugin the content goes through well (so for a new post today I disabled the plugin, edited the code inside the pre-tag, saved the post and re-enabled the plugin). It's really annoying because it's making the code hard to read.

    Using v1.7.1 and added the code inside the pre-tag through the html-editor.

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

  2. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, Hiranthi Molhoek-Herlaar san

    When I disable the plugin the content goes through well (so for a new post today I disabled the plugin, edited the code inside the pre-tag, saved the post and re-enabled the plugin). It's really annoying because it's making the code hard to read.

    It's no wonder.
    After you disabled it , Don't edit your code.

    More precisely, you need to escape your code to HTML entities.
    And you need to use HTML editor.(Don't use Visual editor!)

    <pre>Escaped code</pre>

    When WP SyntaxHighlighter is enabled, WP SyntaxHighlighter do it automatically.

  3. Hiranthi
    Member
    Posted 2 years ago #

    I get the feeling you're misunderstanding me. I had to disable the plugin to get the code to be displayed properly, I didn't disable it just for fun.

    The WP Syntaxhighlighter plugin is adding htmlentities to the entire post-contents, which makes it extremely hard to read on the frontend (and backend too). Extremely annoying.
    I had to disable the plugin to turn the entitized (or whatever it's called) characters back to what they had to be (< > ' & etc) and then enable the plugin again to get the highlighting on the frontend back.

    So: with the plugin enabled all < in the post (whether they're inside pre-tags or not) are getting changed to &gt ; (minus the space ofcourse), which also affects the frontend (since everything inside pre-tags are getting displayed as is). But: when I disable the WP Syntaxhighlighter plugin code between pre-tags aren't getting changed.
    I have also tested with WP Syntaxhighlighter enabled and other pre-plugins (as in: plugins that preserve the code within the pre-tags) disabled but that didn't work either. The only thing that works to keep the code between pre-tags formatted as it should be is with disabling WP Syntaxhighlighter.

    And as I already mentioned in the OT: I didn't use the Visual Editor.

  4. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, Hiranthi Molhoek-Herlaar san

    For security reason, WP Syntaxhighlighter escapes your code inside <pre> tag to HTML entities.

    It's a feature.

    Before you install WP Syntaxhighlighter, If your posts have <pre> tag elements and contents inside them are not eacaped perfectly, this plugin escapes contents inside them to HTML entities.

    So: with the plugin enabled all < in the post (whether they're inside pre-tags or not) are getting changed to &gt ; (minus the space ofcourse), which also affects the frontend (since everything inside pre-tags are getting displayed as is).

    It's a strange result.
    If so, even <pre> tag will be escaped to HTML entities.
    This plugin affects only sourcesode inside <pre> tag.

    Please take a closer look.

    When all plugin are disabled except WP Syntaxhighlighter, does it work?

    But: when I disable the WP Syntaxhighlighter plugin code between pre-tags aren't getting changed.

    When you save your post, this plugin escapes your code inside <pre> tag to HTML entities.(before storing your post data in DB)

    If you saved your post before disable it, your sourcecde can't turn back.

  5. Hiranthi
    Member
    Posted 2 years ago #

    When all plugin are disabled except WP Syntaxhighlighter, does it work?

    As I explained a few times: it only behaves like this when I have WP Syntaxhighlighter enabled, so its definetely something in there. I'm guessing it doesn't put everything back before printing it to the screen (and thus looks awful).

    I'll look into another solution, since this just doesn't work.

  6. vehicros
    Member
    Posted 2 years ago #

    I hate to ask, but the the heck is a REDCOCKER, it sounds really nasty!

  7. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, vehicros san

    "redcocker" means my dog, the red color of English cocker spaniel.
    But He had died

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic