Plugin / Goodbye Syntax Highlighter

Damien White (Visoft, Inc.)

Description

Description

For years I’ve used Alex Gorbatchev’s SyntaxHighlighter. It has served me well over the years. When I moved to WordPress I tried various plugins based on the library, such SyntaxHighlighter Evolved.

I’ve decided to start blogging using Markdown. Making this move I needed to find a way to highlight various bits of source code in an easy way. There are many nice libraries that make this a snap, such as google-code-prettify or highlight.js. In the end I decided to go with highlight.js, for the simple reason that it is automatic, working flawlessly with Markdown’s code syntax output.

Great, but my existing source code examples use SyntaxHighlighter’s style for code blocks (using <pre class="brush: ruby;" />, for example). I could have converted things in a few ways:

  • Change the database
  • Write a JS script to convert the <pre /> structure to <pre><code /></pre>
  • Write a JS script to call highlight.js’ highlightBlock method
  • Write a WP plugin and reformat things easily Ding Ding Ding

So there you have it. This WordPress plugin will go through and process your SyntaxHighlighter style blocks into ones that highlight.js works with out-of-the-box. It will also add the language that you have specified with the brush class and add it as a class on the <code /> element (following the HTML5 recommendation). Nothing is changed in the DB, so if you decide to go back to SyntaxHighlighter, you can without any issues.

GeSHi

This plugin now supports conversion of GeSHi style code blocks! Now you can move from plugins such as WP-Syntax and WP-GeSHi-Highlight to highlight.js.

GeSHi uses the syntax that is close to SyntaxHighlighter, except instead of putting the language in the class attribute, it uses the lang attribute. Similar to the SyntaxHighligher conversion, it will go through and process your GeSHi style blocks into ones that highlight.js works with out-of-the-box. It will also add the language that you have specified with the lang attribute and add it as a class on the <code /> element.

Ratings

5
1 reviews

Rating breakdown

Details Information

Version

0.1.2

First Released

14 Aug, 2012

Total Downloads

2,910

Wordpress Version

3.1 or higher

Tested up to:

3.5.2

Require PHP Version:

-

Tags

Contributors

Languages

The plugin hasn't been transalated in any language other than English.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.