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.
WP-Markdown-Syntax-Sugar
WP Markdown Syntax Sugar work in conjunction with plugins such as wp-markdown
and wp-highlight.js. Markdown is fantastic markup for easily
writing blogs, and highlight.js is an extremely easy way to highlight
code examples. In most cases, highlight.js automatically detects the proper language for a .........
scGeSHi
Simple code highlighting plugin for your remote source files
It is powered by the GeSHi engine which supports a large number of programming languages
The plugin is using styles like Code Snippet. Thanks to Roman Roan and Wyatt Neal. In addition, I would like to thank Jürgen Mayer for making the ba.........
Syntax Highlighter Lite
This plugin prettifies/beautifies/highlights source code placed inside <pre class="prettyprint"> tags. It is a light plugin with only 2 files....
Code Prettify
Uses the Google Code Prettify library
that is minified and properly enqueued. Plugin applies code highlighting
automatically to all <pre> and <code> tags on the page....
WP Code Highlight.js
This is a wordpress plugin for highlight.js library.
Highlight.js highlights syntax in code examples on any web pages.
It's very easy to use because it works automatically: finds
blocks of code, detects a language, highlights it.
This plugin allow you load highlight.js from local storage or from C.........
CodeMirror for CodeEditor
Just another code syntaxhighligher for the theme and plugin editor with CodeMirror. This plugin can highlight sourcecodes in the theme/plugin editor and provide a useful toolbar....
WP-SynHighlight
Plugin provides syntax highlighting in posts and comments.
Full GUI mode. No need to switch to code mode and back like in some other plugins
GUI editor with realtime syntax highligting support integrated (can be disable in settings)
GUI button to help with highlighting options. No need to memorize.........
Sniplets
Sniplets is a generic text insertion plugin with support for an extensible processing framework. At it's simplest this means you can dynamically replace text in your posts with text that may be defined elsewhere, or created by some other module. For example, you can use Sniplets to perform syntax hi.........
WP Chili
Easy code highlighting for WordPress with Chili (the bundled version is 2.2):
Switch to the code tab
Put your code snippet inside <code class="lang"></code> tags
Replace the above lang with the language to highlight
...
Syntax Highlighter Compress
Syntax Highlighter ComPress is a simple WordPress plugin, that is based on the latest Alex Gorbatchev's SyntaxHighlighter Script. Code and source text of different mark-up or programming languages can be highlighted in WordPress.
There are other WordPress plugin based on the SyntaxHighlighter Scrip.........