JSON templates for WordPress Syntax-highlighter Plus

By | March 24, 2018

I needed a WordPress syntax highlighter for JSON and could not find one for my syntax highlighter plus by Fred Wu.

I browsed around and found one from Donavan Brown here. Unfortunately it was for a different version of the syntax highlighter and it was not 100% compatible but it had 90% of the goodies that I need so I simply modified it.

This modification is for WordPress syntax highlighter Plus by Fred Wu.

Below are the instructions required to add JSON support.

  1. Download shBrushJSON the file from here.
  2. Unzip and copy the contents to the plugin directory “/plugins/syntaxhighlighter-plus/syntaxhighlighter/scripts”
  3. Using the editor for the plugins in WordPress open the “/plugins/syntaxhighlighter-plus/syntaxhighlighter.php” file and find the following function:

    function SetVariables().

  4. Add the following line to the syntaxhighlighter.php file after the JScript entry.

    JSON’ => array(‘json’),

And that is it!

To use this use in articles use the alias “json” like in this example. Note I left the closing bracket incomplete for display reasons.

[code language=json]
{
“server.urls”: “https://sub.domain.net:7000”,
“certificate.location”: “Certificates/cert_import.pfx”,
“certificate.password”: “password”
}
[code]

If you are going to use it, please note that I am not planning to support this and I simply provided this for information purposes.

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of