Skip to:
Content
Pages
Categories
Search
Top
Bottom

Crayon Syntax Highlighter not working / tags issue


  • Lexador
    Participant

    @lexador

    Hi,

    I have a problem with syntax highlighter in bbpress (plugin). Normaly, after I’ve used Crayon and paste the example code

    void loop()
    {
    digitalWrite
    }

    it generates in the background (if I switch to text mode)

    <pre class="lang:arduino decode:true crayon-selected">void loop()
    {
    digitalWrite
    }</pre>

    It works good for admin, but if somebody else (member) try to post a code, the tag </pre> disappears, so his code will be not highlighted and in the published post I can see the code and a part of Crayon’s tag like this

    <pre class="lang:arduino decode:true crayon-selected">void loop()
    {
    digitalWrite
    }

    I’ve noticed about restrictions in html-tags etc. but as I can see in formatting.php pre is allowed tag.

    What is the problem?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I just had a play with this and you are correct, it works for administrators/keymasters but not standard ‘participants’ or ‘anonymous’ users.

    Grab this custom KSES plugin I have here https://gist.github.com/ntwb/7797990

    I just added class to to the pre section as that is where the issue is, pre is allowed but <pre class="whatever"> is not.

    Double check any of the other allowed tags and/or remove ones you don’t want/need.

    Edit: I just double checked against the default bbPress allowed tags and all are there, you may or may not want the table sections, up to you. I also made a note to add class as an allowed tag of pre for bbPress core, I can’t think of a reason for us not to add this by default.

    I just added a patch for this, so unless someone comes with a reason to not include this it will be included in bbPress 2.6.

    https://bbpress.trac.wordpress.org/ticket/2653

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.