WordPress.org

Ready to get started?Download WordPress

Forums

WP SyntaxHighlighter
[resolved] Not wrapping lines & requires core edit (4 posts)

  1. djeyewater
    Member
    Posted 2 years ago #

    I am using the default WordPress twentyeleven theme with no other plugins activated. For highlighting the code, I am using the <pre class="brush: code"> format.

    At first the plugin didn't work at all, eventually I found this was because wordpress was stripping the classname from the pre tag. So you need to edit kses.php to allow adding a class to pre. I didn't see this mentioned in the installation instructions, though maybe I missed it. I think that having to edit the wordpress core files is generally frowned upon though.

    The other problem is that, now I have the plugin working, it is not wrapping long lines. Instead it gets a horizontal scrollbar. The line has plenty of spaces in it where it can wrap, so I'm not sure why it won't wrap?

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

  2. redcocker
    Member
    Plugin Author

    Posted 2 years ago #

    Hi, djeyewater san

    >So you need to edit kses.php to allow adding a class to pre.

    This plugin is designed with consideration for KSES filter.
    It adds some tags and attributes to KSES as allowed tags and attributes automatically.

    Did you esit a post as a registerd user belongs to Administrators or Editors?

    >it is not wrapping long lines.

    Go to setting panel.
    Change "Library version" to 2.1.382.
    And enable "Wrap lines".

  3. djeyewater
    Member
    Posted 2 years ago #

    Hi

    User is an Administrator. I did some googling, and maybe the problem is because I am using WordPress multisite: http://danielbachhuber.com/2010/09/09/disabling-htmlkses-filtering-in-wordpress-multisite/. I have now installed the plugin from there, and undid the changes I made to kses.php, and now wordpress does not strip the class tag from pre.

    I made the changes for long lines you suggested, and it is now wrapping nicely.

    Thanks for the plugin and your help!

    Cheers

    Dave

  4. mcmedal001
    Member
    Posted 1 year ago #

    This works great for me, nice work. I was using SyntaxHiglighter compressed before and it generates this horizontal scroll bar which I detest. after so much search, I came across this and it is really working fines. I like the way it wraps the long code lines and the feature to copy to clipboard without first highlighting the code. You can see a live example here: http://www.cynamix.net/2207/how-to-add-pagination-numbered-navigation-to-blogger-blog-blogspot.html

    Great job guys!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.