Sha256: 614b20a7b5e54e2c1122d49d507dfeae468005f24eabc66078de2e6e99db8326

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

/*
Language: JSON
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
*/

hljs.LANGUAGES['json'] = function(hljs) {
  var LITERALS = {literal: 'true false null'};
  var TYPES = [
    hljs.QUOTE_STRING_MODE,
    hljs.C_NUMBER_MODE
  ];
  var VALUE_CONTAINER = {
    className: 'value',
    end: ',', endsWithParent: true, excludeEnd: true,
    contains: TYPES,
    keywords: LITERALS
  };
  var OBJECT = {
    begin: '{', end: '}',
    contains: [
      {
        className: 'attribute',
        begin: '\\s*"', end: '"\\s*:\\s*', excludeBegin: true, excludeEnd: true,
        contains: [hljs.BACKSLASH_ESCAPE],
        illegal: '\\n',
        starts: VALUE_CONTAINER
      }
    ],
    illegal: '\\S'
  };
  var ARRAY = {
    begin: '\\[', end: '\\]',
    contains: [hljs.inherit(VALUE_CONTAINER, {className: null})], // inherit is also a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents
    illegal: '\\S'
  };
  TYPES.splice(TYPES.length, 0, OBJECT, ARRAY);
  return {
    defaultMode: {
      contains: TYPES,
      keywords: LITERALS,
      illegal: '\\S'
    }
  };
}(hljs);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
highlight_js-rails-7.1.0 vendor/assets/javascripts/highlight_js/languages/json.js