Skip to:
Content
Pages
Categories
Search
Top
Bottom

Crayon Syntax Highlighter not working / tags issue

  • @lexador

    Participant

    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 4 replies - 1 through 4 (of 4 total)
  • @netweb

    Keymaster

    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.

    @netweb

    Keymaster

    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

    @peter-kriegel

    Participant

    I post only to confirm that I have a similar issue.

    I have enabled the Crayon Button to Post code over the crayon Popup.
    It inserts allways the pre Tag with a class attribute.
    If I Post as Admin with Crayon Syntax Highlighter in bbPress all is fine.
    If I post as a User the angle brackets of the preliminary pre Tag are geting masked like so:
    & lt; pre class=”lang:arduino decode:true crayon-selected” & gt;

    If I remove the class attribute and put in a simple < pre > all works fine.

    @netweb
    Thank you for your workaround I will Ty it!

    @lexador

    Participant

    Hi Stephen,

    Thank you for this workaround.
    I’ve already found this solution ca. 2 weeks after the request here.
    I thought there is no interest to fix it, so I’ve never written about a solution here.
    Unfartunatelly the notification email about your reply landed in my spam folder.

    I’ve posted my workaround on my own blog (www.5volt-junkie.net, German) like a notice for me, if this issue appears again.

    I’m very impressed, that you guys are tracking this kind of little bugs 🙂

    Thank you!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar