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
- Download shBrushJSON the file from here.
- Unzip and copy the contents to the plugin directory “/plugins/syntaxhighlighter-plus/syntaxhighlighter/scripts”
- Using the editor for the plugins in WordPress open the “/plugins/syntaxhighlighter-plus/syntaxhighlighter.php” file and find the following function:
function SetVariables().
- 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.
{
"server.urls": "https://sub.domain.net:7000",
"certificate.location": "Certificates/cert_import.pfx",
"certificate.password": "password"
}
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.
Pretty! This was an extremely wonderful post. Thank you for providing this info.