Json Brush for SyntaxHighlighter

I was recently working on a post that needed to show some Json. I could not find a Json brush in the GitHub repo for SyntaxHighligter so I created my own.  Below is an example of it in use.  The brush file is attached to this post. 
{
    "compilerOptions": {
        "target": "es5",
        "module": "amd",
        "version": -15,
        "version1": 0.25e5,
        "version2": 3.14,
        "version3": -0.25e5,
        "version4": 0,
        "version5": [0, "string", false],
        "object": {
           "module": "amd",
           "version": -15,
           "version1": 0.25e5,
           "version2": 3.14,
           "version3": -0.25e5,
           "version4": 0,
           "version5": [0, "string", false],
	},
        "sourceMap": true
    }
}

I am using BlogEngine.net 2.9.1.0 that supports SyntaxHighligter.  To use it I first uploaded the file to the editors/tiny_mce_3_5_8/plugins/syntaxhighlighter/scripts/ folder of my blog. Then I updated the shActivator.js in the editors/tiny_mce_3_5_8/plugins/syntaxhighlighter/ folder to add an entry for json.

$(document).ready(function () {
    var root = BlogEngineRes.applicationWebRoot + 'editors/tiny_mce_3_5_8/plugins/syntaxhighlighter/scripts/';
    SyntaxHighlighter.autoloader(
        'applescript            ' + root + 'shBrushAppleScript.js',
        'actionscript3 as3      ' + root + 'shBrushAS3.js',
        'bash shell             ' + root + 'shBrushBash.js',
        'coldfusion cf          ' + root + 'shBrushColdFusion.js',
        'cpp c                  ' + root + 'shBrushCpp.js',
        'c# c-sharp csharp      ' + root + 'shBrushCSharp.js',
        'css                    ' + root + 'shBrushCss.js',
        'delphi pascal          ' + root + 'shBrushDelphi.js',
        'diff patch pas         ' + root + 'shBrushDiff.js',
        'erl erlang             ' + root + 'shBrushErlang.js',
        'groovy                 ' + root + 'shBrushGroovy.js',
        'haxe                   ' + root + 'shBrushHaxe.js',
        'java                   ' + root + 'shBrushJava.js',
        'jfx javafx             ' + root + 'shBrushJavaFX.js',
        'js jscript javascript  ' + root + 'shBrushJScript.js',
        'json                   ' + root + 'shBrushJSon.js',
        'perl pl                ' + root + 'shBrushPerl.js',
        'php                    ' + root + 'shBrushPhp.js',
        'text plain             ' + root + 'shBrushPlain.js',
        'ps powershell          ' + root + 'shBrushPowerShell.js',
        'py python              ' + root + 'shBrushPython.js',
        'ruby rails ror rb      ' + root + 'shBrushRuby.js',
        'sass scss              ' + root + 'shBrushSass.js',
        'scala                  ' + root + 'shBrushScala.js',
        'sql                    ' + root + 'shBrushSql.js',
        'vb vbnet               ' + root + 'shBrushVb.js',
        'xml xhtml xslt html    ' + root + 'shBrushXml.js'
    );
    SyntaxHighlighter.all();
});
shBrushJSon.js (878B)

Comments (2) -

  • You're Awesome!  I looked all over the internet for a syntax highlighter for json and was surprised I couldn't find it anywhere until I stumbled upon your site.  It's working great!  

    I was wondering if it is possible to enforce intent and space rules?
    • There is a Smart tabs feature on the options dialog of Live Writer. That might be what you are looking for.

Add comment

Loading