WP-Markdown-SyntaxHighlighter

WP-Markdown-SyntaxHighlighter works in conjunction with Markdown-formatted code blocks and SyntaxHighlighter to properly format code.

Author:Matt Shelton (profile at wordpress.org)
WordPress version required:3.1
WordPress version tested:3.4.2
Plugin version:0.4
Added to WordPress repository:13-09-2012
Last updated:17-09-2012
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:http://www.mattshelton.net
Total downloads:2 660
Active installs:10+
plugin download
Click to start download

WP-Markdown-SyntaxHighlighter is intended to work with the wp-markdown and SyntaxHighlighter Evolved plugins as follows:

  • WP-Markdown can automatically use Prettify.js to format code, but if you prefer Alex Gorbatchev’s SyntaxHighlighter, this plugin will re-format the Markdown-formatted code blocks to be properly styled by SyntaxHighlighter directly or SyntaxHighlighter Evolved via plugin.
  • SyntaxHighlighter Evolved uses SyntaxHighlighter and additional extended functionality to display code blocks in an easily readable manner.

There are two methods of use:

  1. Add a #! line to your code example and specify the language (brush) only
  2. Add a #!! line to your code example and specify any/all supported parameters via a JSON object

Simple Method

To use, add a #! line as the first line of your code example with the language you are using:

#!ruby
class Foo < Bar
  def hello
    puts "Hello World!"
  end
end

The #! is removed, and the code is reformatted as:

<pre class="brush:ruby; notranslate" title="">class One < Two
  def hello
    puts "Hello World!"
  end
end</pre>

Full Method

To use, add a #!! line as the first line of your code example, with any of the supported SyntaxHighlighter parameters as a JSON object

#!!{"brush":"ruby","toolbar":"true","highlight":"[2,3,4]"}
class Foo < Bar
  def hello
    puts "Hello World!"
  end
end

The #!! is removed, and the parameters are interpreted into a CSS class string as:

<pre class="brush: ruby; toolbar: true; highlight: [2,3,4]; notranslate">class Foo < Bar
  def hello
    puts "Hello World!"
  end
end</pre>

TODO

  • Consider adding support to toggle ‘notranslate’

ChangeLog