highlight.js
Advanced tools
Comparing version 7.3.0 to 7.4.0
@@ -95,4 +95,5 @@ module.exports = function(hljs) { | ||
} | ||
].concat(COMMENTS) | ||
].concat(COMMENTS), | ||
illegal: '//' | ||
}; | ||
}; |
module.exports = function(hljs) { | ||
return { | ||
keywords: 'false int abstract private char interface boolean static null if for true ' + | ||
'while long throw finally protected extends final implements return void enum else ' + | ||
'break new catch byte super class case short default double public try this switch ' + | ||
keywords: 'false int abstract private char boolean static null if for true ' + | ||
'while long throw finally protected final return void enum else ' + | ||
'break new catch byte super case short default double public try this switch ' + | ||
'continue reverse firstfast firstonly forupdate nofetch sum avg minof maxof count ' + | ||
@@ -7,0 +7,0 @@ 'order group by asc desc index hint like dispaly edit client server ttsbegin ' + |
61
bash.js
module.exports = function(hljs) { | ||
var BASH_LITERAL = 'true false'; | ||
var BASH_KEYWORD = 'if then else elif fi for break continue while in do done echo exit return set declare'; | ||
var VAR1 = { | ||
className: 'variable', begin: '\\$[a-zA-Z0-9_#]+' | ||
className: 'variable', begin: /\$[\w\d#@][\w\d_]*/ | ||
}; | ||
var VAR2 = { | ||
className: 'variable', begin: '\\${([^}]|\\\\})+}' | ||
className: 'variable', begin: /\$\{(.*?)\}/ | ||
}; | ||
var QUOTE_STRING = { | ||
className: 'string', | ||
begin: '"', end: '"', | ||
illegal: '\\n', | ||
contains: [hljs.BACKSLASH_ESCAPE, VAR1, VAR2], | ||
begin: /"/, end: /"/, | ||
contains: [ | ||
hljs.BACKSLASH_ESCAPE, | ||
VAR1, | ||
VAR2, | ||
{ | ||
className: 'variable', | ||
begin: /\$\(/, end: /\)/, | ||
contains: hljs.BACKSLASH_ESCAPE | ||
} | ||
], | ||
relevance: 0 | ||
@@ -19,20 +25,19 @@ }; | ||
className: 'string', | ||
begin: '\'', end: '\'', | ||
contains: [{begin: '\'\''}], | ||
begin: /'/, end: /'/, | ||
relevance: 0 | ||
}; | ||
var TEST_CONDITION = { | ||
className: 'test_condition', | ||
begin: '', end: '', | ||
contains: [QUOTE_STRING, APOS_STRING, VAR1, VAR2], | ||
keywords: { | ||
literal: BASH_LITERAL | ||
}, | ||
relevance: 0 | ||
}; | ||
return { | ||
lexems: /-?[a-z]+/, | ||
keywords: { | ||
keyword: BASH_KEYWORD, | ||
literal: BASH_LITERAL | ||
keyword: | ||
'if then else elif fi for break continue while in do done exit return set '+ | ||
'declare case esac export exec', | ||
literal: | ||
'true false', | ||
built_in: | ||
'printf echo read cd pwd pushd popd dirs let eval unset typeset readonly '+ | ||
'getopts source shopt caller type hash bind help sudo', | ||
operator: | ||
'-ne -eq -lt -gt -f -d -e -s -l -a' // relevance booster | ||
}, | ||
@@ -42,14 +47,20 @@ contains: [ | ||
className: 'shebang', | ||
begin: '(#!\\/bin\\/bash)|(#!\\/bin\\/sh)', | ||
begin: /^#![^\n]+sh\s*$/, | ||
relevance: 10 | ||
}, | ||
VAR1, | ||
VAR2, | ||
{ | ||
className: 'function', | ||
begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/, | ||
returnBegin: true, | ||
contains: [{className: 'title', begin: /\w[\w\d_]*/}], | ||
relevance: 0 | ||
}, | ||
hljs.HASH_COMMENT_MODE, | ||
hljs.NUMBER_MODE, | ||
QUOTE_STRING, | ||
APOS_STRING, | ||
hljs.inherit(TEST_CONDITION, {begin: '\\[ ', end: ' \\]', relevance: 0}), | ||
hljs.inherit(TEST_CONDITION, {begin: '\\[\\[ ', end: ' \\]\\]'}) | ||
VAR1, | ||
VAR2 | ||
] | ||
}; | ||
}; |
@@ -70,7 +70,6 @@ module.exports = function(hljs) { | ||
className: 'list', | ||
begin: '\\(', end: '\\)', | ||
relevance: 0 | ||
begin: '\\(', end: '\\)' | ||
}; | ||
var BODY = { | ||
endsWithParent: true, excludeEnd: true, | ||
endsWithParent: true, | ||
keywords: {literal: 'true false nil'}, | ||
@@ -77,0 +76,0 @@ relevance: 0 |
@@ -13,5 +13,8 @@ module.exports = function(hljs) { | ||
// Coffee literals | ||
'yes no on off ', | ||
reserved: 'case default function var void with const let enum export import native ' + | ||
'__hasProp __extends __slice __bind __indexOf' | ||
'yes no on off', | ||
reserved: | ||
'case default function var void with const let enum export import native ' + | ||
'__hasProp __extends __slice __bind __indexOf', | ||
built_in: | ||
'npm require console print module exports global window document' | ||
}; | ||
@@ -24,26 +27,61 @@ var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; | ||
keywords: KEYWORDS, | ||
contains: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE] | ||
}; | ||
var EXPRESSIONS = [ | ||
// Numbers | ||
hljs.BINARY_NUMBER_MODE, | ||
hljs.inherit(hljs.C_NUMBER_MODE, {starts: {end: '(\\s*/)?', relevance: 0}}), // a number tries to eat the following slash to prevent treating it as a regexp | ||
// Strings | ||
{ | ||
className: 'string', | ||
begin: '\'\'\'', end: '\'\'\'', | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
}, | ||
{ | ||
className: 'string', | ||
begin: '\'', end: '\'', | ||
contains: [hljs.BACKSLASH_ESCAPE], | ||
relevance: 0 | ||
}, | ||
{ | ||
className: 'string', | ||
begin: '"""', end: '"""', | ||
contains: [hljs.BACKSLASH_ESCAPE, SUBST] | ||
}, | ||
{ | ||
className: 'string', | ||
begin: '"', end: '"', | ||
contains: [hljs.BACKSLASH_ESCAPE, SUBST], | ||
relevance: 0 | ||
}, | ||
// RegExps | ||
{ | ||
className: 'regexp', | ||
begin: '///', end: '///', | ||
contains: [hljs.HASH_COMMENT_MODE] | ||
}, | ||
{ | ||
className: 'regexp', begin: '//[gim]*', | ||
relevance: 0 | ||
}, | ||
{ | ||
className: 'regexp', | ||
begin: '/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)' // \S is required to parse x / 2 / 3 as two divisions | ||
}, | ||
{ | ||
className: 'property', | ||
begin: '@' + JS_IDENT_RE | ||
}, | ||
{ | ||
begin: '`', end: '`', | ||
excludeBegin: true, excludeEnd: true, | ||
subLanguage: 'javascript' | ||
} | ||
]; | ||
SUBST.contains = EXPRESSIONS; | ||
return { | ||
keywords: KEYWORDS, | ||
contains: [ | ||
// Numbers | ||
hljs.BINARY_NUMBER_MODE, | ||
hljs.C_NUMBER_MODE, | ||
// Strings | ||
hljs.APOS_STRING_MODE, | ||
contains: EXPRESSIONS.concat([ | ||
{ | ||
className: 'string', | ||
begin: '"""', end: '"""', | ||
contains: [hljs.BACKSLASH_ESCAPE, SUBST] | ||
}, | ||
{ | ||
className: 'string', | ||
begin: '"', end: '"', | ||
contains: [hljs.BACKSLASH_ESCAPE, SUBST], | ||
relevance: 0 | ||
}, | ||
// Comments | ||
{ | ||
className: 'comment', | ||
@@ -54,21 +92,4 @@ begin: '###', end: '###' | ||
{ | ||
className: 'regexp', | ||
begin: '///', end: '///', | ||
contains: [hljs.HASH_COMMENT_MODE] | ||
}, | ||
{ | ||
className: 'regexp', begin: '//[gim]*' | ||
}, | ||
{ | ||
className: 'regexp', | ||
begin: '/\\S(\\\\.|[^\\n])*/[gim]*' // \S is required to parse x / 2 / 3 as two divisions | ||
}, | ||
{ | ||
begin: '`', end: '`', | ||
excludeBegin: true, excludeEnd: true, | ||
subLanguage: 'javascript' | ||
}, | ||
{ | ||
className: 'function', | ||
begin: JS_IDENT_RE + '\\s*=\\s*(\\(.+\\))?\\s*[-=]>', | ||
begin: '(' + JS_IDENT_RE + '\\s*=\\s*)?(\\(.*\\))?\\s*[-=]>', end: '[-=]>', | ||
returnBegin: true, | ||
@@ -79,3 +100,10 @@ contains: [ | ||
className: 'params', | ||
begin: '\\(', end: '\\)' | ||
begin: '\\(', returnBegin: true, | ||
/* We need another contained nameless mode to not have every nested | ||
pair of parens to be called "params" */ | ||
contains: [{ | ||
begin: /\(/, end: /\)/, | ||
keywords: KEYWORDS, | ||
contains: ['self'].concat(EXPRESSIONS) | ||
}] | ||
} | ||
@@ -88,3 +116,3 @@ ] | ||
end: '$', | ||
illegal: ':', | ||
illegal: '[:\\[\\]]', | ||
contains: [ | ||
@@ -101,7 +129,8 @@ { | ||
{ | ||
className: 'property', | ||
begin: '@' + JS_IDENT_RE | ||
className: 'attribute', | ||
begin: JS_IDENT_RE + ':', end: ':', | ||
returnBegin: true, excludeEnd: true | ||
} | ||
] | ||
]) | ||
}; | ||
}; |
@@ -33,3 +33,7 @@ module.exports = function(hljs) { | ||
className: 'preprocessor', | ||
begin: '#', end: '$' | ||
begin: '#', end: '$', | ||
contains: [ | ||
{begin: '<', end: '>', illegal: '\\n'}, | ||
hljs.C_LINE_COMMENT_MODE | ||
] | ||
}, | ||
@@ -36,0 +40,0 @@ { |
@@ -10,3 +10,3 @@ module.exports = function(hljs) { | ||
'sealed short sizeof stackalloc static string struct switch this throw true try typeof ' + | ||
'uint ulong unchecked unsafe ushort using virtual volatile void while ' + | ||
'uint ulong unchecked unsafe ushort using virtual volatile void while async await ' + | ||
// Contextual keywords. | ||
@@ -13,0 +13,0 @@ 'ascending descending from get group into join let orderby partial select set value var '+ |
27
css.js
module.exports = function(hljs) { | ||
var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*'; | ||
var FUNCTION = { | ||
className: 'function', | ||
begin: hljs.IDENT_RE + '\\(', end: '\\)', | ||
contains: [hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE] | ||
begin: IDENT_RE + '\\(', end: '\\)', | ||
contains: ['self', hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE] | ||
}; | ||
@@ -40,12 +41,20 @@ return { | ||
// the default mode which is how it should be. | ||
excludeEnd: true, | ||
keywords: 'import page media charset', | ||
contains: [ | ||
FUNCTION, | ||
hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, | ||
hljs.NUMBER_MODE | ||
{ | ||
className: 'keyword', | ||
begin: /\S+/ | ||
}, | ||
{ | ||
begin: /\s/, endsWithParent: true, excludeEnd: true, | ||
relevance: 0, | ||
contains: [ | ||
FUNCTION, | ||
hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, | ||
hljs.NUMBER_MODE | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
className: 'tag', begin: hljs.IDENT_RE, | ||
className: 'tag', begin: IDENT_RE, | ||
relevance: 0 | ||
@@ -79,3 +88,3 @@ }, | ||
{ | ||
className: 'hexcolor', begin: '\\#[0-9A-F]+' | ||
className: 'hexcolor', begin: '#[0-9A-Fa-f]+' | ||
}, | ||
@@ -82,0 +91,0 @@ { |
@@ -33,3 +33,3 @@ module.exports = function(hljs) { | ||
className: 'filter', | ||
begin: '\\|[A-Za-z]+\\:?', excludeEnd: true, | ||
begin: '\\|[A-Za-z]+\\:?', | ||
keywords: | ||
@@ -69,3 +69,4 @@ 'truncatewords removetags linebreaksbr yesno get_digit timesince random striptags ' + | ||
'get_current_language_bidi get_language_info get_language_info_list localize ' + | ||
'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone', | ||
'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone ' + | ||
'verbatim', | ||
contains: [FILTER] | ||
@@ -72,0 +73,0 @@ }, |
@@ -10,2 +10,3 @@ module.exports = function(hljs) { | ||
begin: '\\(', end: '\\)', | ||
illegal: '"', | ||
contains: [ | ||
@@ -81,5 +82,6 @@ {className: 'type', begin: '\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?'}, | ||
className: 'title', begin: '^[_a-z][\\w\']*' | ||
} | ||
}, | ||
{begin: '->|<-'} // No markup, relevance booster | ||
] | ||
}; | ||
}; |
@@ -31,3 +31,3 @@ var hljs = new function() { | ||
function blockLanguage(block) { | ||
var classes = (block.className + ' ' + block.parentNode.className).split(/\s+/); | ||
var classes = (block.className + ' ' + (block.parentNode ? block.parentNode.className : '')).split(/\s+/); | ||
classes = classes.map(function(c) {return c.replace(/^language-/, '')}); | ||
@@ -135,5 +135,9 @@ for (var i = 0; i < classes.length; i++) { | ||
function reStr(re) { | ||
return (re && re.source) || re; | ||
} | ||
function langRe(value, global) { | ||
return RegExp( | ||
value, | ||
reStr(value), | ||
'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '') | ||
@@ -160,3 +164,3 @@ ); | ||
mode.lexemsRe = langRe(mode.lexems || hljs.IDENT_RE, true); | ||
mode.lexemsRe = langRe(mode.lexems || hljs.IDENT_RE + '(?!\\.)', true); | ||
if (typeof mode.keywords == 'string') { // string | ||
@@ -175,3 +179,3 @@ flatten('keyword', mode.keywords) | ||
if (mode.beginWithKeyword) { | ||
mode.begin = '\\b(' + keywords.join('|') + ')\\s'; | ||
mode.begin = '\\b(' + keywords.join('|') + ')\\b(?!\\.)\\s*'; | ||
} | ||
@@ -183,3 +187,3 @@ mode.beginRe = langRe(mode.begin ? mode.begin : '\\B|\\b'); | ||
mode.endRe = langRe(mode.end); | ||
mode.terminator_end = mode.end || ''; | ||
mode.terminator_end = reStr(mode.end) || ''; | ||
if (mode.endsWithParent && parent.terminator_end) | ||
@@ -207,9 +211,9 @@ mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end; | ||
for (var i = 0; i < mode.contains.length; i++) { | ||
terminators.push(mode.contains[i].begin); | ||
terminators.push(reStr(mode.contains[i].begin)); | ||
} | ||
if (mode.terminator_end) { | ||
terminators.push(mode.terminator_end); | ||
terminators.push(reStr(mode.terminator_end)); | ||
} | ||
if (mode.illegal) { | ||
terminators.push(mode.illegal); | ||
terminators.push(reStr(mode.illegal)); | ||
} | ||
@@ -231,3 +235,3 @@ mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : {exec: function(s) {return null;}}; | ||
*/ | ||
function highlight(language_name, value) { | ||
function highlight(language_name, value, ignore_illegals) { | ||
@@ -253,3 +257,3 @@ function subMode(lexem, mode) { | ||
function isIllegal(lexem, mode) { | ||
return mode.illegal && mode.illegalRe.test(lexem); | ||
return !ignore_illegals && mode.illegal && mode.illegalRe.test(lexem); | ||
} | ||
@@ -318,3 +322,2 @@ | ||
top = Object.create(mode, {parent: {value: top}}); | ||
relevance += mode.relevance; | ||
} | ||
@@ -338,3 +341,4 @@ | ||
if (end_mode) { | ||
if (!(end_mode.returnEnd || end_mode.excludeEnd)) { | ||
var origin = top; | ||
if (!(origin.returnEnd || origin.excludeEnd)) { | ||
mode_buffer += lexem; | ||
@@ -347,5 +351,6 @@ } | ||
} | ||
relevance += top.relevance; | ||
top = top.parent; | ||
} while (top != end_mode.parent); | ||
if (end_mode.excludeEnd) { | ||
if (origin.excludeEnd) { | ||
result += escape(lexem); | ||
@@ -357,7 +362,7 @@ } | ||
} | ||
return end_mode.returnEnd ? 0 : lexem.length; | ||
return origin.returnEnd ? 0 : lexem.length; | ||
} | ||
if (isIllegal(lexem, top)) | ||
throw 'Illegal'; | ||
throw new Error('Illegal lexem "' + lexem + '" for mode "' + (top.className || '<unnamed>') + '"'); | ||
@@ -398,3 +403,3 @@ /* | ||
} catch (e) { | ||
if (e == 'Illegal') { | ||
if (e.message.indexOf('Illegal') != -1) { | ||
return { | ||
@@ -433,3 +438,3 @@ relevance: 0, | ||
continue; | ||
var current = highlight(key, text); | ||
var current = highlight(key, text, false); | ||
current.language = key; | ||
@@ -478,3 +483,3 @@ if (current.keyword_count + current.relevance > second_best.keyword_count + second_best.relevance) { | ||
return; | ||
var result = language ? highlight(language, text) : highlightAuto(text); | ||
var result = language ? highlight(language, text, true) : highlightAuto(text); | ||
language = result.language; | ||
@@ -547,3 +552,3 @@ var original = nodeStream(block); | ||
this.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... | ||
this.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; | ||
this.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; | ||
@@ -595,2 +600,15 @@ // Common modes | ||
}; | ||
this.REGEXP_MODE = { | ||
className: 'regexp', | ||
begin: /\//, end: /\/[gim]*/, | ||
illegal: /\n/, | ||
contains: [ | ||
this.BACKSLASH_ESCAPE, | ||
{ | ||
begin: /\[/, end: /\]/, | ||
relevance: 0, | ||
contains: [this.BACKSLASH_ESCAPE] | ||
} | ||
] | ||
} | ||
@@ -614,4 +632,6 @@ // Utility functions | ||
hljs.LANGUAGES['rust'] = require('./rust.js')(hljs); | ||
hljs.LANGUAGES['ruleslanguage'] = require('./ruleslanguage.js')(hljs); | ||
hljs.LANGUAGES['rib'] = require('./rib.js')(hljs); | ||
hljs.LANGUAGES['diff'] = require('./diff.js')(hljs); | ||
hljs.LANGUAGES['haml'] = require('./haml.js')(hljs); | ||
hljs.LANGUAGES['javascript'] = require('./javascript.js')(hljs); | ||
@@ -628,2 +648,3 @@ hljs.LANGUAGES['glsl'] = require('./glsl.js')(hljs); | ||
hljs.LANGUAGES['java'] = require('./java.js')(hljs); | ||
hljs.LANGUAGES['fsharp'] = require('./fsharp.js')(hljs); | ||
hljs.LANGUAGES['php'] = require('./php.js')(hljs); | ||
@@ -637,5 +658,7 @@ hljs.LANGUAGES['haskell'] = require('./haskell.js')(hljs); | ||
hljs.LANGUAGES['sql'] = require('./sql.js')(hljs); | ||
hljs.LANGUAGES['handlebars'] = require('./handlebars.js')(hljs); | ||
hljs.LANGUAGES['vala'] = require('./vala.js')(hljs); | ||
hljs.LANGUAGES['ini'] = require('./ini.js')(hljs); | ||
hljs.LANGUAGES['d'] = require('./d.js')(hljs); | ||
hljs.LANGUAGES['vbnet'] = require('./vbnet.js')(hljs); | ||
hljs.LANGUAGES['axapta'] = require('./axapta.js')(hljs); | ||
@@ -649,2 +672,3 @@ hljs.LANGUAGES['perl'] = require('./perl.js')(hljs); | ||
hljs.LANGUAGES['coffeescript'] = require('./coffeescript.js')(hljs); | ||
hljs.LANGUAGES['mizar'] = require('./mizar.js')(hljs); | ||
hljs.LANGUAGES['nginx'] = require('./nginx.js')(hljs); | ||
@@ -660,5 +684,8 @@ hljs.LANGUAGES['erlang-repl'] = require('./erlang-repl.js')(hljs); | ||
hljs.LANGUAGES['apache'] = require('./apache.js')(hljs); | ||
hljs.LANGUAGES['scss'] = require('./scss.js')(hljs); | ||
hljs.LANGUAGES['applescript'] = require('./applescript.js')(hljs); | ||
hljs.LANGUAGES['lasso'] = require('./lasso.js')(hljs); | ||
hljs.LANGUAGES['cpp'] = require('./cpp.js')(hljs); | ||
hljs.LANGUAGES['matlab'] = require('./matlab.js')(hljs); | ||
hljs.LANGUAGES['asciidoc'] = require('./asciidoc.js')(hljs); | ||
hljs.LANGUAGES['parser3'] = require('./parser3.js')(hljs); | ||
@@ -665,0 +692,0 @@ hljs.LANGUAGES['clojure'] = require('./clojure.js')(hljs); |
@@ -22,3 +22,4 @@ module.exports = function(hljs) { | ||
keywords: 'on off true false yes no', | ||
contains: [hljs.QUOTE_STRING_MODE, hljs.NUMBER_MODE] | ||
contains: [hljs.QUOTE_STRING_MODE, hljs.NUMBER_MODE], | ||
relevance: 0 | ||
} | ||
@@ -25,0 +26,0 @@ ] |
@@ -13,3 +13,3 @@ module.exports = function(hljs) { | ||
contains: [{ | ||
className: 'javadoctag', begin: '@[A-Za-z]+' | ||
className: 'javadoctag', begin: '(^|\\s)@[A-Za-z]+' | ||
}], | ||
@@ -26,2 +26,3 @@ relevance: 10 | ||
keywords: 'class interface', | ||
excludeEnd: true, | ||
illegal: ':', | ||
@@ -28,0 +29,0 @@ contains: [ |
@@ -23,10 +23,5 @@ module.exports = function(hljs) { | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
{ | ||
className: 'regexp', | ||
begin: '/', end: '/[gim]*', | ||
illegal: '\\n', | ||
contains: [{begin: '\\\\/'}] | ||
}, | ||
hljs.REGEXP_MODE, | ||
{ // E4X | ||
begin: '<', end: '>;', | ||
begin: /</, end: />;/, | ||
subLanguage: 'xml' | ||
@@ -39,11 +34,11 @@ } | ||
className: 'function', | ||
beginWithKeyword: true, end: '{', | ||
beginWithKeyword: true, end: /{/, | ||
keywords: 'function', | ||
contains: [ | ||
{ | ||
className: 'title', begin: '[A-Za-z$_][0-9A-Za-z$_]*' | ||
className: 'title', begin: /[A-Za-z$_][0-9A-Za-z$_]*/ | ||
}, | ||
{ | ||
className: 'params', | ||
begin: '\\(', end: '\\)', | ||
begin: /\(/, end: /\)/, | ||
contains: [ | ||
@@ -53,6 +48,6 @@ hljs.C_LINE_COMMENT_MODE, | ||
], | ||
illegal: '["\'\\(]' | ||
illegal: /["'\(]/ | ||
} | ||
], | ||
illegal: '\\[|%' | ||
illegal: /\[|%/ | ||
} | ||
@@ -59,0 +54,0 @@ ] |
11
lisp.js
module.exports = function(hljs) { | ||
var LISP_IDENT_RE = '[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#]*'; | ||
var LISP_IDENT_RE = '[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#!]*'; | ||
var LISP_SIMPLE_NUMBER_RE = '(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?'; | ||
var SHEBANG = { | ||
className: 'shebang', | ||
begin: '^#!', end: '$' | ||
}; | ||
var LITERAL = { | ||
@@ -63,4 +67,4 @@ className: 'literal', | ||
var BODY = { | ||
className: 'body', | ||
endsWithParent: true, excludeEnd: true | ||
endsWithParent: true, | ||
relevance: 0 | ||
}; | ||
@@ -73,2 +77,3 @@ LIST.contains = [{className: 'title', begin: LISP_IDENT_RE}, BODY]; | ||
contains: NUMBERS.concat([ | ||
SHEBANG, | ||
LITERAL, | ||
@@ -75,0 +80,0 @@ STRING, |
@@ -89,3 +89,4 @@ module.exports = function(hljs) { | ||
} | ||
] | ||
], | ||
relevance: 0 | ||
} | ||
@@ -92,0 +93,0 @@ ], |
@@ -6,6 +6,6 @@ module.exports = function(hljs) { | ||
'unsigned long volatile static protected bool mutable if public do return goto void ' + | ||
'enum else break extern class asm case short default double throw register explicit ' + | ||
'enum else break extern asm case short default double throw register explicit ' + | ||
'signed typename try this switch continue wchar_t inline readonly assign property ' + | ||
'protocol self synchronized end synthesize id optional required implementation ' + | ||
'nonatomic interface super unichar finally dynamic IBOutlet IBAction selector strong ' + | ||
'self synchronized end synthesize id optional required ' + | ||
'nonatomic super unichar finally dynamic IBOutlet IBAction selector strong ' + | ||
'weak readonly', | ||
@@ -25,3 +25,3 @@ literal: | ||
'UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar ' + | ||
'NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection class ' + | ||
'NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection ' + | ||
'UIInterfaceOrientation MPMoviePlayerController dispatch_once_t ' + | ||
@@ -80,3 +80,4 @@ 'dispatch_queue_t dispatch_sync dispatch_async dispatch_once' | ||
className: 'variable', | ||
begin: '\\.'+hljs.UNDERSCORE_IDENT_RE | ||
begin: '\\.'+hljs.UNDERSCORE_IDENT_RE, | ||
relevance: 0 | ||
} | ||
@@ -83,0 +84,0 @@ ] |
110
package.json
{ | ||
"author": { | ||
"email": "maniac@softwaremaniacs.org", | ||
"name": "Ivan Sagalaev" | ||
}, | ||
"homepage": "http://highlightjs.org/", | ||
"bugs": { | ||
"url": "https://github.com/isagalaev/highlight.js/issues" | ||
}, | ||
"version": "7.4.0", | ||
"name": "highlight.js", | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"name": "highlight.js", | ||
"licenses": [ | ||
{ | ||
"type": "BSD" | ||
} | ||
], | ||
"keywords": [ | ||
"highlight", | ||
"syntax" | ||
], | ||
"repository": { | ||
"url": "git://github.com/isagalaev/highlight.js.git", | ||
"type": "git" | ||
}, | ||
"description": "Syntax highlighting with language autodetection.", | ||
"main": "./highlight.js", | ||
"contributors": [ | ||
@@ -246,29 +270,65 @@ { | ||
"email": "drdrang@gmail.com" | ||
} | ||
], | ||
"author": { | ||
"name": "Ivan Sagalaev", | ||
"email": "maniac@softwaremaniacs.org" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/isagalaev/highlight.js/issues" | ||
}, | ||
"repository": { | ||
"url": "git://github.com/isagalaev/highlight.js.git", | ||
"type": "git" | ||
}, | ||
"licenses": [ | ||
}, | ||
{ | ||
"type": "BSD" | ||
"name": "Robin Ward", | ||
"email": "robin.ward@gmail.com" | ||
}, | ||
{ | ||
"name": "Dmitry Medvinsky", | ||
"email": "me@dmedvinsky.name" | ||
}, | ||
{ | ||
"name": "Jason Jacobson", | ||
"email": "jason.a.jacobson@gmail.com" | ||
}, | ||
{ | ||
"name": "Jonas Folles\u00f8", | ||
"email": "jonas@follesoe.no" | ||
}, | ||
{ | ||
"name": "Dan Allen", | ||
"email": "dan.j.allen@gmail.com" | ||
}, | ||
{ | ||
"name": "noformnocontent", | ||
"email": "i@noformnocontent.com" | ||
}, | ||
{ | ||
"name": "Damien White", | ||
"email": "damien.white@visoftinc.com" | ||
}, | ||
{ | ||
"name": "Alexander Marenin", | ||
"email": "great_muchacho@mail.ru" | ||
}, | ||
{ | ||
"name": "C\u00e9dric N\u00e9h\u00e9mie", | ||
"email": "cedric.nehemie@gmail.com" | ||
}, | ||
{ | ||
"name": "Simon Madine", | ||
"email": "simon@angryrobotzombie.com" | ||
}, | ||
{ | ||
"name": "Benjamin Pannell", | ||
"email": "contact@sierrasoftworks.com" | ||
}, | ||
{ | ||
"name": "Eric Knibbe", | ||
"email": "eric@lassosoft.com" | ||
}, | ||
{ | ||
"name": "Poren Chiang", | ||
"email": "ren.chiang@gmail.com" | ||
}, | ||
{ | ||
"name": "Kelley van Evert", | ||
"email": "kelleyvanevert@gmail.com" | ||
}, | ||
{ | ||
"name": "Kurt Emch", | ||
"email": "kurt@kurtemch.com" | ||
} | ||
], | ||
"version": "7.3.0", | ||
"scripts": {}, | ||
"keywords": [ | ||
"highlight", | ||
"syntax" | ||
], | ||
"main": "./highlight.js", | ||
"homepage": "http://softwaremaniacs.org/soft/highlight/en/", | ||
"description": "Syntax highlighting with language autodetection." | ||
"scripts": {} | ||
} |
module.exports = function(hljs) { | ||
return { | ||
subLanguage: 'xml', | ||
subLanguage: 'xml', relevance: 0, | ||
contains: [ | ||
@@ -5,0 +5,0 @@ { |
@@ -6,3 +6,3 @@ module.exports = function(hljs) { | ||
{ | ||
className: 'builtin', | ||
className: 'built_in', | ||
begin: '{', end: '}$', | ||
@@ -9,0 +9,0 @@ excludeBegin: true, excludeEnd: true, |
module.exports = function(hljs) { | ||
var PROMPT = { | ||
className: 'prompt', begin: '^(>>>|\\.\\.\\.) ' | ||
className: 'prompt', begin: /^(>>>|\.\.\.) / | ||
} | ||
@@ -8,3 +8,3 @@ var STRINGS = [ | ||
className: 'string', | ||
begin: '(u|b)?r?\'\'\'', end: '\'\'\'', | ||
begin: /(u|b)?r?'''/, end: /'''/, | ||
contains: [PROMPT], | ||
@@ -15,3 +15,3 @@ relevance: 10 | ||
className: 'string', | ||
begin: '(u|b)?r?"""', end: '"""', | ||
begin: /(u|b)?r?"""/, end: /"""/, | ||
contains: [PROMPT], | ||
@@ -22,3 +22,3 @@ relevance: 10 | ||
className: 'string', | ||
begin: '(u|r|ur)\'', end: '\'', | ||
begin: /(u|r|ur)'/, end: /'/, | ||
contains: [hljs.BACKSLASH_ESCAPE], | ||
@@ -29,3 +29,3 @@ relevance: 10 | ||
className: 'string', | ||
begin: '(u|r|ur)"', end: '"', | ||
begin: /(u|r|ur)"/, end: /"/, | ||
contains: [hljs.BACKSLASH_ESCAPE], | ||
@@ -36,3 +36,3 @@ relevance: 10 | ||
className: 'string', | ||
begin: '(b|br)\'', end: '\'', | ||
begin: /(b|br)'/, end: /'/, | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
@@ -42,3 +42,3 @@ }, | ||
className: 'string', | ||
begin: '(b|br)"', end: '"', | ||
begin: /(b|br)"/, end: /"/, | ||
contains: [hljs.BACKSLASH_ESCAPE] | ||
@@ -55,8 +55,8 @@ } | ||
className: 'params', | ||
begin: '\\(', end: '\\)', | ||
begin: /\(/, end: /\)/, | ||
contains: ['self', hljs.C_NUMBER_MODE, PROMPT].concat(STRINGS) | ||
}; | ||
var FUNC_CLASS_PROTO = { | ||
beginWithKeyword: true, end: ':', | ||
illegal: '[${=;\\n]', | ||
beginWithKeyword: true, end: /:/, | ||
illegal: /[${=;\n]/, | ||
contains: [TITLE, PARAMS], | ||
@@ -75,3 +75,3 @@ relevance: 10 | ||
}, | ||
illegal: '(</|->|\\?)', | ||
illegal: /(<\/|->|\?)/, | ||
contains: STRINGS.concat([ | ||
@@ -85,6 +85,6 @@ PROMPT, | ||
className: 'decorator', | ||
begin: '@', end: '$' | ||
begin: /@/, end: /$/ | ||
}, | ||
{ | ||
begin: '\\b(print|exec)\\(' // don’t highlight keywords-turned-functions in Python 3 | ||
begin: /\b(print|exec)\(/ // don’t highlight keywords-turned-functions in Python 3 | ||
} | ||
@@ -91,0 +91,0 @@ ]) |
11
rust.js
@@ -12,6 +12,7 @@ module.exports = function(hljs) { | ||
var KEYWORDS = | ||
'alt any as assert be bind block bool break char check claim const cont dir do else enum ' + | ||
'export f32 f64 fail false float fn for i16 i32 i64 i8 if iface impl import in int let ' + | ||
'log mod mutable native note of prove pure resource ret self str syntax true type u16 u32 ' + | ||
'u64 u8 uint unchecked unsafe use vec while'; | ||
'assert bool break char check claim comm const cont copy dir do drop ' + | ||
'else enum extern export f32 f64 fail false float fn for i16 i32 i64 i8 ' + | ||
'if impl int let log loop match mod move mut priv pub pure ref return ' + | ||
'self static str struct task true trait type u16 u32 u64 u8 uint unsafe ' + | ||
'use vec while'; | ||
return { | ||
@@ -44,3 +45,3 @@ keywords: KEYWORDS, | ||
beginWithKeyword: true, end: '({|<)', | ||
keywords: 'iface enum', | ||
keywords: 'trait enum', | ||
contains: [TITLE], | ||
@@ -47,0 +48,0 @@ illegal: '\\S' |
@@ -34,3 +34,6 @@ module.exports = function(hljs) { | ||
className: 'localvars', | ||
begin: '\\|\\s*((' + VAR_IDENT_RE + ')\\s*)+\\|' | ||
// This looks more complicated than needed to avoid combinatorial | ||
// explosion under V8. It effectively means `| var1 var2 ... |` with | ||
// whitespace adjacent to `|` being optional. | ||
begin: '\\|\\s*' + VAR_IDENT_RE + '(\\s+' + VAR_IDENT_RE + ')*\\s*\\|' | ||
}, | ||
@@ -37,0 +40,0 @@ { |
@@ -7,3 +7,3 @@ module.exports = function(hljs) { | ||
className: 'operator', | ||
begin: '(begin|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b(?!:)', // negative look-ahead here is specifically to prevent stomping on SmallTalk | ||
begin: '(begin|end|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma|grant)\\b(?!:)', // negative look-ahead here is specifically to prevent stomping on SmallTalk | ||
end: ';', endsWithParent: true, | ||
@@ -30,3 +30,3 @@ keywords: { | ||
'work order cascade diagnostics nchar having left call do handler load replace ' + | ||
'truncate start lock show pragma exists number', | ||
'truncate start lock show pragma exists number trigger if before after each row', | ||
aggregate: 'count sum min max avg' | ||
@@ -33,0 +33,0 @@ }, |
@@ -28,8 +28,5 @@ module.exports = function(hljs) { | ||
keywords: 'class interface delegate namespace', | ||
illegal: '[^,:\\n\\s\\.]', | ||
contains: [ | ||
{ | ||
beginWithKeyword: true, | ||
keywords: 'extends implements' | ||
}, | ||
{ | ||
className: 'title', | ||
@@ -36,0 +33,0 @@ begin: hljs.UNDERSCORE_IDENT_RE |
@@ -5,2 +5,3 @@ module.exports = function(hljs) { | ||
endsWithParent: true, | ||
relevance: 0, | ||
contains: [ | ||
@@ -93,5 +94,6 @@ { | ||
begin: '</?', end: '/?>', | ||
relevance: 0, | ||
contains: [ | ||
{ | ||
className: 'title', begin: '[^ />]+' | ||
className: 'title', begin: '[^ /><]+' | ||
}, | ||
@@ -98,0 +100,0 @@ TAG_INTERNALS |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
204975
65
5369