Socket
Socket
Sign inDemoInstall

highlight.js

Package Overview
Dependencies
Maintainers
2
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highlight.js - npm Package Compare versions

Comparing version 8.0.0 to 8.1.0

docs/api.rst

76

lib/highlight.js

@@ -18,17 +18,5 @@ var Highlight = function() {

function blockText(block) {
return Array.prototype.map.call(block.childNodes, function(node) {
if (node.nodeType == 3) {
return options.useBR ? node.nodeValue.replace(/\n/g, '') : node.nodeValue;
}
if (tag(node) == 'br') {
return '\n';
}
return blockText(node);
}).join('');
}
function blockLanguage(block) {
var classes = (block.className + ' ' + (block.parentNode ? block.parentNode.className : '')).split(/\s+/);
classes = classes.map(function(c) {return c.replace(/^language-/, '');});
classes = classes.map(function(c) {return c.replace(/^lang(uage)?-/, '');});
return classes.filter(function(c) {return getLanguage(c) || c == 'no-highlight';})[0];

@@ -173,3 +161,3 @@ }

function flatten(className, str) {
var flatten = function(className, str) {
if (language.case_insensitive) {

@@ -182,3 +170,3 @@ str = str.toLowerCase();

});
}
};

@@ -198,3 +186,3 @@ if (typeof mode.keywords == 'string') { // string

if (mode.beginKeywords) {
mode.begin = mode.beginKeywords.split(' ').join('|');
mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\b';
}

@@ -236,6 +224,5 @@ if (!mode.begin)

mode.contains.map(function(c) {
return c.beginKeywords ? '\\.?\\b(' + c.begin + ')\\b\\.?' : c.begin;
return c.beginKeywords ? '\\.?(' + c.begin + ')\\.?' : c.begin;
})
.concat([mode.terminator_end])
.concat([mode.illegal])
.concat([mode.terminator_end, mode.illegal])
.map(reStr)

@@ -299,22 +286,21 @@ .filter(Boolean);

function processKeywords() {
var buffer = escape(mode_buffer);
if (!top.keywords)
return buffer;
return escape(mode_buffer);
var result = '';
var last_index = 0;
top.lexemesRe.lastIndex = 0;
var match = top.lexemesRe.exec(buffer);
var match = top.lexemesRe.exec(mode_buffer);
while (match) {
result += buffer.substr(last_index, match.index - last_index);
result += escape(mode_buffer.substr(last_index, match.index - last_index));
var keyword_match = keywordMatch(top, match);
if (keyword_match) {
relevance += keyword_match[1];
result += buildSpan(keyword_match[0], match[0]);
result += buildSpan(keyword_match[0], escape(match[0]));
} else {
result += match[0];
result += escape(match[0]);
}
last_index = top.lexemesRe.lastIndex;
match = top.lexemesRe.exec(buffer);
match = top.lexemesRe.exec(mode_buffer);
}
return result + buffer.substr(last_index);
return result + escape(mode_buffer.substr(last_index));
}

@@ -420,3 +406,3 @@

if (current.className) {
result = buildSpan(current.className, result, true);
result += buildSpan(current.className, result, true);
}

@@ -522,3 +508,5 @@ }

function highlightBlock(block) {
var text = blockText(block);
var text = options.useBR ? block.innerHTML
.replace(/\n/g,'').replace(/<br>|<br [^>]*>/g, '\n').replace(/<[^>]*>/g,'')
: block.textContent;
var language = blockLanguage(block);

@@ -594,2 +582,6 @@ if (language == 'no-highlight')

function listLanguages() {
return Object.keys(languages);
}
function getLanguage(name) {

@@ -609,2 +601,3 @@ return languages[name] || languages[aliases[name]];

this.registerLanguage = registerLanguage;
this.listLanguages = listLanguages;
this.getLanguage = getLanguage;

@@ -637,13 +630,19 @@ this.inherit = inherit;

};
this.PHRASAL_WORDS_MODE = {
begin: /\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/
};
this.C_LINE_COMMENT_MODE = {
className: 'comment',
begin: '//', end: '$'
begin: '//', end: '$',
contains: [this.PHRASAL_WORDS_MODE]
};
this.C_BLOCK_COMMENT_MODE = {
className: 'comment',
begin: '/\\*', end: '\\*/'
begin: '/\\*', end: '\\*/',
contains: [this.PHRASAL_WORDS_MODE]
};
this.HASH_COMMENT_MODE = {
className: 'comment',
begin: '#', end: '$'
begin: '#', end: '$',
contains: [this.PHRASAL_WORDS_MODE]
};

@@ -665,2 +664,15 @@ this.NUMBER_MODE = {

};
this.CSS_NUMBER_MODE = {
className: 'number',
begin: this.NUMBER_RE + '(' +
'%|em|ex|ch|rem' +
'|vw|vh|vmin|vmax' +
'|cm|mm|in|pt|pc|px' +
'|deg|grad|rad|turn' +
'|s|ms' +
'|Hz|kHz' +
'|dpi|dpcm|dppx' +
')?',
relevance: 0
};
this.REGEXP_MODE = {

@@ -667,0 +679,0 @@ className: 'regexp',

@@ -5,6 +5,11 @@ var Highlight = require('./highlight');

hljs.registerLanguage('fix', require('./languages/fix.js'));
hljs.registerLanguage('nsis', require('./languages/nsis.js'));
hljs.registerLanguage('haxe', require('./languages/haxe.js'));
hljs.registerLanguage('erlang', require('./languages/erlang.js'));
hljs.registerLanguage('cs', require('./languages/cs.js'));
hljs.registerLanguage('protobuf', require('./languages/protobuf.js'));
hljs.registerLanguage('vim', require('./languages/vim.js'));
hljs.registerLanguage('brainfuck', require('./languages/brainfuck.js'));
hljs.registerLanguage('ruby', require('./languages/ruby.js'));
hljs.registerLanguage('nimrod', require('./languages/nimrod.js'));
hljs.registerLanguage('rust', require('./languages/rust.js'));

@@ -22,2 +27,3 @@ hljs.registerLanguage('ruleslanguage', require('./languages/ruleslanguage.js'));

hljs.registerLanguage('css', require('./languages/css.js'));
hljs.registerLanguage('capnproto', require('./languages/capnproto.js'));
hljs.registerLanguage('lisp', require('./languages/lisp.js'));

@@ -27,7 +33,10 @@ hljs.registerLanguage('profile', require('./languages/profile.js'));

hljs.registerLanguage('java', require('./languages/java.js'));
hljs.registerLanguage('gherkin', require('./languages/gherkin.js'));
hljs.registerLanguage('fsharp', require('./languages/fsharp.js'));
hljs.registerLanguage('mathematica', require('./languages/mathematica.js'));
hljs.registerLanguage('swift', require('./languages/swift.js'));
hljs.registerLanguage('php', require('./languages/php.js'));
hljs.registerLanguage('haskell', require('./languages/haskell.js'));
hljs.registerLanguage('1c', require('./languages/1c.js'));
hljs.registerLanguage('x86asm', require('./languages/x86asm.js'));
hljs.registerLanguage('python', require('./languages/python.js'));

@@ -38,4 +47,7 @@ hljs.registerLanguage('smalltalk', require('./languages/smalltalk.js'));

hljs.registerLanguage('sql', require('./languages/sql.js'));
hljs.registerLanguage('nix', require('./languages/nix.js'));
hljs.registerLanguage('handlebars', require('./languages/handlebars.js'));
hljs.registerLanguage('thrift', require('./languages/thrift.js'));
hljs.registerLanguage('vala', require('./languages/vala.js'));
hljs.registerLanguage('gradle', require('./languages/gradle.js'));
hljs.registerLanguage('ini', require('./languages/ini.js'));

@@ -68,2 +80,3 @@ hljs.registerLanguage('livecodeserver', require('./languages/livecodeserver.js'));

hljs.registerLanguage('scss', require('./languages/scss.js'));
hljs.registerLanguage('monkey', require('./languages/monkey.js'));
hljs.registerLanguage('applescript', require('./languages/applescript.js'));

@@ -78,3 +91,5 @@ hljs.registerLanguage('lasso', require('./languages/lasso.js'));

hljs.registerLanguage('clojure', require('./languages/clojure.js'));
hljs.registerLanguage('elixir', require('./languages/elixir.js'));
hljs.registerLanguage('typescript', require('./languages/typescript.js'));
hljs.registerLanguage('go', require('./languages/go.js'));
module.exports = hljs;

@@ -12,2 +12,3 @@ module.exports = function(hljs) {

return {
aliases: ['as'],
keywords: {

@@ -34,3 +35,3 @@ keyword: 'as break case catch class const continue default delete do dynamic each ' +

className: 'class',
beginKeywords: 'class interface', end: '{',
beginKeywords: 'class interface', end: '{', excludeEnd: true,
contains: [

@@ -49,3 +50,3 @@ {

className: 'function',
beginKeywords: 'function', end: '[{;]',
beginKeywords: 'function', end: '[{;]', excludeEnd: true,
illegal: '\\S',

@@ -52,0 +53,0 @@ contains: [

module.exports = function(hljs) {
var NUMBER = {className: 'number', begin: '[\\$%]\\d+'};
return {
aliases: ['apacheconf'],
case_insensitive: true,

@@ -5,0 +6,0 @@ contains: [

@@ -11,3 +11,3 @@ module.exports = function(hljs) {

className: 'comment',
begin: '--', end: '$',
begin: '--', end: '$'
},

@@ -23,2 +23,3 @@ {

return {
aliases: ['osascript'],
keywords: {

@@ -33,3 +34,3 @@ keyword:

'reference repeat returning script second set seventh since ' +
'sixth some tell tenth that the then third through thru ' +
'sixth some tell tenth that the|0 then third through thru ' +
'timeout times to transaction try until where while whose with ' +

@@ -36,0 +37,0 @@ 'without',

module.exports = function(hljs) {
return {
case_insensitive: true,
lexemes: '\\.?' + hljs.IDENT_RE,
keywords: {

@@ -26,3 +27,6 @@ keyword:

'porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ' +
'ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf'
'ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf',
preprocessor:
'.byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list ' +
'.listmac .macro .nolist .org .set'
},

@@ -46,6 +50,2 @@ contains: [

{className: 'preprocessor', begin: '#', end: '$'},
{ // директивы «.include» «.macro» и т.д.
className: 'preprocessor',
begin: '\\.[a-zA-Z]+'
},
{ // подстановка в «.macro»

@@ -52,0 +52,0 @@ className: 'localvars',

@@ -21,3 +21,3 @@ module.exports = function(hljs) {

className: 'class',
beginKeywords: 'class interface', end: '{',
beginKeywords: 'class interface', end: '{', excludeEnd: true,
illegal: ':',

@@ -24,0 +24,0 @@ contains: [

@@ -28,2 +28,3 @@ module.exports = function(hljs) {

return {
aliases: ['sh', 'zsh'],
lexemes: /-?[a-z\.]+/,

@@ -30,0 +31,0 @@ keywords: {

@@ -8,2 +8,3 @@ module.exports = function(hljs){

return {
aliases: ['bf'],
contains: [

@@ -10,0 +11,0 @@ {

@@ -85,2 +85,3 @@ module.exports = function(hljs) {

return {
aliases: ['clj'],
illegal: /\S/,

@@ -87,0 +88,0 @@ contains: [

module.exports = function(hljs) {
return {
aliases: ['cmake.in'],
case_insensitive: true,

@@ -4,0 +5,0 @@ keywords: {

@@ -18,3 +18,3 @@ module.exports = function(hljs) {

built_in:
'npm require console print module exports global window document'
'npm require console print module global window document'
};

@@ -81,2 +81,3 @@ var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';

return {
aliases: ['coffee', 'cson', 'iced'],
keywords: KEYWORDS,

@@ -83,0 +84,0 @@ contains: EXPRESSIONS.concat([

@@ -21,3 +21,3 @@ module.exports = function(hljs) {

return {
aliases: ['c'],
aliases: ['c', 'h', 'c++', 'h++'],
keywords: CPP_KEYWORDS,

@@ -42,4 +42,9 @@ illegal: '</',

begin: '#', end: '$',
keywords: 'if else elif endif define undef warning error line pragma',
contains: [
{begin: 'include\\s*<', end: '>', illegal: '\\n'},
{
begin: 'include\\s*[<"]', end: '[>"]',
keywords: 'include',
illegal: '\\n'
},
hljs.C_LINE_COMMENT_MODE

@@ -52,4 +57,6 @@ ]

keywords: CPP_KEYWORDS,
relevance: 10,
contains: ['self']
},
{
begin: hljs.IDENT_RE + '::'
}

@@ -56,0 +63,0 @@ ]

@@ -14,3 +14,5 @@ module.exports = function(hljs) {

return {
aliases: ['csharp'],
keywords: KEYWORDS,
illegal: /::/,
contains: [

@@ -23,7 +25,13 @@ {

className: 'xmlDocTag',
begin: '///|<!--|-->'
},
{
className: 'xmlDocTag',
begin: '</?', end: '>'
variants: [
{
begin: '///', relevance: 0
},
{
begin: '<!--|-->'
},
{
begin: '</?', end: '>'
}
]
}

@@ -30,0 +38,0 @@ ]

@@ -5,4 +5,6 @@ module.exports = function(hljs) {

className: 'function',
begin: IDENT_RE + '\\(', end: '\\)',
contains: ['self', hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE]
begin: IDENT_RE + '\\(',
returnBegin: true,
excludeEnd: true,
end: '\\('
};

@@ -53,3 +55,3 @@ return {

hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE
hljs.CSS_NUMBER_MODE
]

@@ -84,3 +86,3 @@ }

FUNCTION,
hljs.NUMBER_MODE,
hljs.CSS_NUMBER_MODE,
hljs.QUOTE_STRING_MODE,

@@ -87,0 +89,0 @@ hljs.APOS_STRING_MODE,

@@ -18,242 +18,240 @@ module.exports = /**

function(hljs) {
/**
* Language keywords
*
* @type {Object}
*/
var D_KEYWORDS = {
keyword:
'abstract alias align asm assert auto body break byte case cast catch class ' +
'const continue debug default delete deprecated do else enum export extern final ' +
'finally for foreach foreach_reverse|10 goto if immutable import in inout int ' +
'interface invariant is lazy macro mixin module new nothrow out override package ' +
'pragma private protected public pure ref return scope shared static struct ' +
'super switch synchronized template this throw try typedef typeid typeof union ' +
'unittest version void volatile while with __FILE__ __LINE__ __gshared|10 ' +
'__thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__',
built_in:
'bool cdouble cent cfloat char creal dchar delegate double dstring float function ' +
'idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar ' +
'wstring',
literal:
'false null true'
};
/**
* Language keywords
*
* @type {Object}
*/
var D_KEYWORDS = {
keyword:
'abstract alias align asm assert auto body break byte case cast catch class ' +
'const continue debug default delete deprecated do else enum export extern final ' +
'finally for foreach foreach_reverse|10 goto if immutable import in inout int ' +
'interface invariant is lazy macro mixin module new nothrow out override package ' +
'pragma private protected public pure ref return scope shared static struct ' +
'super switch synchronized template this throw try typedef typeid typeof union ' +
'unittest version void volatile while with __FILE__ __LINE__ __gshared|10 ' +
'__thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__',
built_in:
'bool cdouble cent cfloat char creal dchar delegate double dstring float function ' +
'idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar ' +
'wstring',
literal:
'false null true'
};
/**
* Number literal regexps
*
* @type {String}
*/
var decimal_integer_re = '(0|[1-9][\\d_]*)',
decimal_integer_nosus_re = '(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)',
binary_integer_re = '0[bB][01_]+',
hexadecimal_digits_re = '([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)',
hexadecimal_integer_re = '0[xX]' + hexadecimal_digits_re,
/**
* Number literal regexps
*
* @type {String}
*/
var decimal_integer_re = '(0|[1-9][\\d_]*)',
decimal_integer_nosus_re = '(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)',
binary_integer_re = '0[bB][01_]+',
hexadecimal_digits_re = '([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)',
hexadecimal_integer_re = '0[xX]' + hexadecimal_digits_re,
decimal_exponent_re = '([eE][+-]?' + decimal_integer_nosus_re + ')',
decimal_float_re = '(' + decimal_integer_nosus_re + '(\\.\\d*|' + decimal_exponent_re + ')|' +
'\\d+\\.' + decimal_integer_nosus_re + decimal_integer_nosus_re + '|' +
'\\.' + decimal_integer_re + decimal_exponent_re + '?' +
')',
hexadecimal_float_re = '(0[xX](' +
hexadecimal_digits_re + '\\.' + hexadecimal_digits_re + '|'+
'\\.?' + hexadecimal_digits_re +
')[pP][+-]?' + decimal_integer_nosus_re + ')',
decimal_exponent_re = '([eE][+-]?' + decimal_integer_nosus_re + ')',
decimal_float_re = '(' + decimal_integer_nosus_re + '(\\.\\d*|' + decimal_exponent_re + ')|' +
'\\d+\\.' + decimal_integer_nosus_re + decimal_integer_nosus_re + '|' +
'\\.' + decimal_integer_re + decimal_exponent_re + '?' +
')',
hexadecimal_float_re = '(0[xX](' +
hexadecimal_digits_re + '\\.' + hexadecimal_digits_re + '|'+
'\\.?' + hexadecimal_digits_re +
')[pP][+-]?' + decimal_integer_nosus_re + ')',
integer_re = '(' +
decimal_integer_re + '|' +
binary_integer_re + '|' +
hexadecimal_integer_re +
')',
integer_re = '(' +
decimal_integer_re + '|' +
binary_integer_re + '|' +
hexadecimal_integer_re +
')',
float_re = '(' +
hexadecimal_float_re + '|' +
decimal_float_re +
')';
float_re = '(' +
hexadecimal_float_re + '|' +
decimal_float_re +
')';
/**
* Escape sequence supported in D string and character literals
*
* @type {String}
*/
var escape_sequence_re = '\\\\(' +
'[\'"\\?\\\\abfnrtv]|' + // common escapes
'u[\\dA-Fa-f]{4}|' + // four hex digit unicode codepoint
'[0-7]{1,3}|' + // one to three octal digit ascii char code
'x[\\dA-Fa-f]{2}|' + // two hex digit ascii char code
'U[\\dA-Fa-f]{8}' + // eight hex digit unicode codepoint
')|' +
'&[a-zA-Z\\d]{2,};'; // named character entity
/**
* Escape sequence supported in D string and character literals
*
* @type {String}
*/
var escape_sequence_re = '\\\\(' +
'[\'"\\?\\\\abfnrtv]|' + // common escapes
'u[\\dA-Fa-f]{4}|' + // four hex digit unicode codepoint
'[0-7]{1,3}|' + // one to three octal digit ascii char code
'x[\\dA-Fa-f]{2}|' + // two hex digit ascii char code
'U[\\dA-Fa-f]{8}' + // eight hex digit unicode codepoint
')|' +
'&[a-zA-Z\\d]{2,};'; // named character entity
/**
* D integer number literals
*
* @type {Object}
*/
var D_INTEGER_MODE = {
className: 'number',
begin: '\\b' + integer_re + '(L|u|U|Lu|LU|uL|UL)?',
relevance: 0
};
/**
* [D_FLOAT_MODE description]
* @type {Object}
*/
var D_FLOAT_MODE = {
className: 'number',
begin: '\\b(' +
float_re + '([fF]|L|i|[fF]i|Li)?|' +
integer_re + '(i|[fF]i|Li)' +
')',
relevance: 0
};
/**
* D integer number literals
*
* @type {Object}
*/
var D_INTEGER_MODE = {
className: 'number',
begin: '\\b' + integer_re + '(L|u|U|Lu|LU|uL|UL)?',
relevance: 0
};
/**
* D character literal
*
* @type {Object}
*/
var D_CHARACTER_MODE = {
className: 'string',
begin: '\'(' + escape_sequence_re + '|.)', end: '\'',
illegal: '.'
};
/**
* [D_FLOAT_MODE description]
* @type {Object}
*/
var D_FLOAT_MODE = {
className: 'number',
begin: '\\b(' +
float_re + '([fF]|L|i|[fF]i|Li)?|' +
integer_re + '(i|[fF]i|Li)' +
')',
relevance: 0
};
/**
* D string escape sequence
*
* @type {Object}
*/
var D_ESCAPE_SEQUENCE = {
begin: escape_sequence_re,
relevance: 0
};
/**
* D character literal
*
* @type {Object}
*/
var D_CHARACTER_MODE = {
className: 'string',
begin: '\'(' + escape_sequence_re + '|.)', end: '\'',
illegal: '.'
};
/**
* D double quoted string literal
*
* @type {Object}
*/
var D_STRING_MODE = {
className: 'string',
begin: '"',
contains: [D_ESCAPE_SEQUENCE],
end: '"[cwd]?'
};
/**
* D string escape sequence
*
* @type {Object}
*/
var D_ESCAPE_SEQUENCE = {
begin: escape_sequence_re,
relevance: 0
}
/**
* D wysiwyg and delimited string literals
*
* @type {Object}
*/
var D_WYSIWYG_DELIMITED_STRING_MODE = {
className: 'string',
begin: '[rq]"',
end: '"[cwd]?',
relevance: 5
};
/**
* D double quoted string literal
*
* @type {Object}
*/
var D_STRING_MODE = {
className: 'string',
begin: '"',
contains: [D_ESCAPE_SEQUENCE],
end: '"[cwd]?'
};
/**
* D alternate wysiwyg string literal
*
* @type {Object}
*/
var D_ALTERNATE_WYSIWYG_STRING_MODE = {
className: 'string',
begin: '`',
end: '`[cwd]?'
};
/**
* D wysiwyg and delimited string literals
*
* @type {Object}
*/
var D_WYSIWYG_DELIMITED_STRING_MODE = {
className: 'string',
begin: '[rq]"',
end: '"[cwd]?',
relevance: 5
};
/**
* D hexadecimal string literal
*
* @type {Object}
*/
var D_HEX_STRING_MODE = {
className: 'string',
begin: 'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',
relevance: 10
};
/**
* D alternate wysiwyg string literal
*
* @type {Object}
*/
var D_ALTERNATE_WYSIWYG_STRING_MODE = {
className: 'string',
begin: '`',
end: '`[cwd]?'
};
/**
* D delimited string literal
*
* @type {Object}
*/
var D_TOKEN_STRING_MODE = {
className: 'string',
begin: 'q"\\{',
end: '\\}"'
};
/**
* D hexadecimal string literal
*
* @type {Object}
*/
var D_HEX_STRING_MODE = {
className: 'string',
begin: 'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',
relevance: 10
};
/**
* Hashbang support
*
* @type {Object}
*/
var D_HASHBANG_MODE = {
className: 'shebang',
begin: '^#!',
end: '$',
relevance: 5
};
/**
* D delimited string literal
*
* @type {Object}
*/
var D_TOKEN_STRING_MODE = {
className: 'string',
begin: 'q"\\{',
end: '\\}"'
};
/**
* D special token sequence
*
* @type {Object}
*/
var D_SPECIAL_TOKEN_SEQUENCE_MODE = {
className: 'preprocessor',
begin: '#(line)',
end: '$',
relevance: 5
};
/**
* Hashbang support
*
* @type {Object}
*/
var D_HASHBANG_MODE = {
className: 'shebang',
begin: '^#!',
end: '$',
relevance: 5
};
/**
* D attributes
*
* @type {Object}
*/
var D_ATTRIBUTE_MODE = {
className: 'keyword',
begin: '@[a-zA-Z_][a-zA-Z_\\d]*'
};
/**
* D special token sequence
*
* @type {Object}
*/
var D_SPECIAL_TOKEN_SEQUENCE_MODE = {
className: 'preprocessor',
begin: '#(line)',
end: '$',
relevance: 5
};
/**
* D nesting comment
*
* @type {Object}
*/
var D_NESTING_COMMENT_MODE = {
className: 'comment',
begin: '\\/\\+',
contains: ['self'],
end: '\\+\\/',
relevance: 10
};
/**
* D attributes
*
* @type {Object}
*/
var D_ATTRIBUTE_MODE = {
className: 'keyword',
begin: '@[a-zA-Z_][a-zA-Z_\\d]*'
};
/**
* D nesting comment
*
* @type {Object}
*/
var D_NESTING_COMMENT_MODE = {
className: 'comment',
begin: '\\/\\+',
contains: ['self'],
end: '\\+\\/',
relevance: 10
}
return {
lexemes: hljs.UNDERSCORE_IDENT_RE,
keywords: D_KEYWORDS,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
D_NESTING_COMMENT_MODE,
D_HEX_STRING_MODE,
D_STRING_MODE,
D_WYSIWYG_DELIMITED_STRING_MODE,
D_ALTERNATE_WYSIWYG_STRING_MODE,
D_TOKEN_STRING_MODE,
D_FLOAT_MODE,
D_INTEGER_MODE,
D_CHARACTER_MODE,
D_HASHBANG_MODE,
D_SPECIAL_TOKEN_SEQUENCE_MODE,
D_ATTRIBUTE_MODE
]
};
return {
lexemes: hljs.UNDERSCORE_IDENT_RE,
keywords: D_KEYWORDS,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
D_NESTING_COMMENT_MODE,
D_HEX_STRING_MODE,
D_STRING_MODE,
D_WYSIWYG_DELIMITED_STRING_MODE,
D_ALTERNATE_WYSIWYG_STRING_MODE,
D_TOKEN_STRING_MODE,
D_FLOAT_MODE,
D_INTEGER_MODE,
D_CHARACTER_MODE,
D_HASHBANG_MODE,
D_SPECIAL_TOKEN_SEQUENCE_MODE,
D_ATTRIBUTE_MODE
]
};
};
module.exports = function(hljs) {
return {
aliases: ['patch'],
contains: [

@@ -4,0 +5,0 @@ {

@@ -21,2 +21,3 @@ module.exports = function(hljs) {

return {
aliases: ['jinja'],
case_insensitive: true,

@@ -23,0 +24,0 @@ subLanguage: 'xml', subLanguageMode: 'continuous',

module.exports = function(hljs) {
return {
aliases: ['bat', 'cmd'],
case_insensitive: true,

@@ -4,0 +5,0 @@ keywords: {

@@ -14,4 +14,3 @@ module.exports = function(hljs) {

className: 'comment',
begin: '%', end: '$',
relevance: 0
begin: '%', end: '$'
};

@@ -115,4 +114,5 @@ var NUMBER = {

return {
aliases: ['erl'],
keywords: ERLANG_RESERVED,
illegal: '(</|\\*=|\\+=|-=|/=|/\\*|\\*/|\\(\\*|\\*\\))',
illegal: '(</|\\*=|\\+=|-=|/\\*|\\*/|\\(\\*|\\*\\))',
contains: [

@@ -145,3 +145,3 @@ {

'-import -include -include_lib -compile -define -else -endif -file -behaviour ' +
'-behavior',
'-behavior -spec',
contains: [PARAMS]

@@ -153,5 +153,6 @@ },

VAR1, VAR2,
TUPLE
TUPLE,
{begin: /\.$/} // relevance booster
]
};
};
module.exports = function(hljs) {
return {
aliases: ['fs'],
keywords:

@@ -11,3 +12,2 @@ 'abstract and as assert base begin class default delegate do done ' +

contains: [
{

@@ -28,3 +28,3 @@ className: 'string',

className: 'class',
beginKeywords: 'type', end: '\\(|=|$',
beginKeywords: 'type', end: '\\(|=|$', excludeEnd: true,
contains: [

@@ -47,3 +47,3 @@ hljs.UNDERSCORE_TITLE_MODE

]
}
};
};

@@ -102,3 +102,3 @@ module.exports = // TODO support filter tags like :javascript, support inline HTML

]
},
}
]

@@ -105,0 +105,0 @@ }

module.exports = function(hljs) {
var EXPRESSION_KEYWORDS = 'each in with if else unless bindattr action collection debugger log outlet template unbound view yield';
return {
aliases: ['hbs', 'html.hbs', 'html.handlebars'],
case_insensitive: true,

@@ -5,0 +6,0 @@ subLanguage: 'xml', subLanguageMode: 'continuous',

@@ -49,2 +49,3 @@ module.exports = function(hljs) {

return {
aliases: ['hs'],
keywords:

@@ -51,0 +52,0 @@ 'let in if then else case of where do module import hiding ' +

@@ -8,2 +8,3 @@ module.exports = function(hljs) {

return {
aliases: ['jsp'],
keywords: KEYWORDS,

@@ -30,4 +31,4 @@ illegal: /<\//,

className: 'class',
beginKeywords: 'class interface', endsWithParent: true,
illegal: /[:"<>]/,
beginKeywords: 'class interface', endsWithParent: true, excludeEnd: true,
illegal: /[:"\[\]]/,
contains: [

@@ -34,0 +35,0 @@ {

@@ -17,3 +17,4 @@ module.exports = function(hljs) {

'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require'
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
'module console window document'
},

@@ -48,3 +49,3 @@ contains: [

className: 'function',
beginKeywords: 'function', end: /\{/,
beginKeywords: 'function', end: /\{/, excludeEnd: true,
contains: [

@@ -51,0 +52,0 @@ hljs.inherit(hljs.TITLE_MODE, {begin: /[A-Za-z$_][0-9A-Za-z$_]*/}),

@@ -45,3 +45,3 @@ module.exports = function(hljs) {

returnEnd: true,
contains: [ HTML_COMMENT ]
contains: [HTML_COMMENT]
}

@@ -61,3 +61,4 @@ };

className: 'javadoc',
begin: '/\\*\\*!', end: '\\*/'
begin: '/\\*\\*!', end: '\\*/',
contains: [hljs.PHRASAL_WORDS_MODE]
},

@@ -91,3 +92,11 @@ hljs.C_BLOCK_COMMENT_MODE,

className: 'attribute',
begin: '\\.\\.\\.|-' + hljs.UNDERSCORE_IDENT_RE
variants: [
{
begin: '-' + hljs.UNDERSCORE_IDENT_RE,
relevance: 0
},
{
begin: '(\\.\\.\\.)'
}
]
},

@@ -99,3 +108,3 @@ {

begin: '->\\s*',
contains: [ LASSO_DATAMEMBER ]
contains: [LASSO_DATAMEMBER]
},

@@ -112,3 +121,3 @@ {

relevance: 0,
contains: [ LASSO_DATAMEMBER ]
contains: [LASSO_DATAMEMBER]
},

@@ -139,3 +148,3 @@ {

relevance: 0,
contains: [ HTML_COMMENT ]
contains: [HTML_COMMENT]
}

@@ -161,3 +170,3 @@ },

returnEnd: true,
contains: [ HTML_COMMENT ]
contains: [HTML_COMMENT]
}

@@ -164,0 +173,0 @@ },

@@ -44,10 +44,14 @@ module.exports = function(hljs) {

{
begin: '[\'`]\\(', end: '\\)',
begin: '[\'`]\\(', end: '\\)'
},
{
begin: '\\(quote ', end: '\\)',
keywords: {title: 'quote'},
keywords: {title: 'quote'}
}
]
};
var QUOTED_ATOM = {
className: 'quoted',
begin: '\'' + LISP_IDENT_RE
};
var LIST = {

@@ -62,3 +66,3 @@ className: 'list',

LIST.contains = [{className: 'title', begin: LISP_IDENT_RE}, BODY];
BODY.contains = [QUOTED, LIST, LITERAL, NUMBER, STRING, COMMENT, VARIABLE, KEYWORD];
BODY.contains = [QUOTED, QUOTED_ATOM, LIST, LITERAL, NUMBER, STRING, COMMENT, VARIABLE, KEYWORD];

@@ -74,2 +78,3 @@ return {

QUOTED,
QUOTED_ATOM,
LIST

@@ -76,0 +81,0 @@ ]

@@ -12,6 +12,6 @@ module.exports = function(hljs) {

{
begin: '--',
begin: '--'
},
{
begin: '[^:]//',
begin: '[^:]//'
}

@@ -18,0 +18,0 @@ ]

@@ -52,3 +52,3 @@ module.exports = function(hljs) {

contains: [LONG_BRACKETS],
relevance: 10
relevance: 5
}

@@ -55,0 +55,0 @@ ])

@@ -6,4 +6,5 @@ module.exports = function(hljs) {

contains: [hljs.BACKSLASH_ESCAPE]
}
};
return {
aliases: ['mk', 'mak'],
contains: [

@@ -22,3 +23,3 @@ hljs.HASH_COMMENT_MODE,

VARIABLE
],
]
}

@@ -25,0 +26,0 @@ }

module.exports = function(hljs) {
return {
aliases: ['md', 'mkdown', 'mkd'],
contains: [

@@ -78,3 +79,3 @@ // highlight headers

begin: '\\]\\[', end: '\\]',
excludeBegin: true, excludeEnd: true,
excludeBegin: true, excludeEnd: true
}

@@ -81,0 +82,0 @@ ],

module.exports = function(hljs) {
var COMMON_CONTAINS = [

@@ -63,5 +62,9 @@ hljs.C_NUMBER_MODE,

className: 'cell',
begin: '\\{', end: '\\}\'*[\\.\']*',
begin: '\\{',
contains: COMMON_CONTAINS,
illegal: /:/
illegal: /:/,
variants: [
{end: /\}'[\.']*/},
{end: /\}/, relevance: 0}
]
},

@@ -68,0 +71,0 @@ {

@@ -63,2 +63,3 @@ module.exports = function(hljs) {

return {
aliases: ['nginxconf'],
contains: [

@@ -69,3 +70,7 @@ hljs.HASH_COMMENT_MODE,

contains: [
hljs.inherit(hljs.UNDERSCORE_TITLE_MODE, {starts: DEFAULT})
{
className: 'title',
begin: hljs.UNDERSCORE_IDENT_RE,
starts: DEFAULT
}
],

@@ -72,0 +77,0 @@ relevance: 0

@@ -8,6 +8,7 @@ module.exports = function(hljs) {

'signed typename this switch continue wchar_t inline readonly assign ' +
'self synchronized id ' +
'nonatomic super unichar IBOutlet IBAction strong weak ' +
'readwrite self @synchronized id typeof ' +
'nonatomic super unichar IBOutlet IBAction strong weak copy ' +
'in out inout bycopy byref oneway __strong __weak __block __autoreleasing ' +
'@private @protected @public @try @property @end @throw @catch @finally ' +
'@synthesize @dynamic @selector @optional @required',
'@autoreleasepool @synthesize @dynamic @selector @optional @required',
literal:

@@ -17,2 +18,3 @@ 'false true FALSE TRUE nil YES NO NULL',

'NSString NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView ' +
'NSView NSViewController NSWindow NSWindowController NSSet NSUUID NSIndexSet ' +
'UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread ' +

@@ -34,2 +36,3 @@ 'UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool ' +

return {
aliases: ['m', 'mm', 'objc', 'obj-c'],
keywords: OBJC_KEYWORDS, lexemes: LEXEMES,

@@ -44,32 +47,31 @@ illegal: '</',

className: 'string',
begin: '\'',
end: '[^\\\\]\'',
illegal: '[^\\\\][^\']'
variants: [
{
begin: '@"', end: '"',
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: '\'', end: '[^\\\\]\'',
illegal: '[^\\\\][^\']'
}
]
},
{
className: 'preprocessor',
begin: '#import',
begin: '#',
end: '$',
contains: [
{
className: 'title',
begin: '\"',
end: '\"'
},
{
className: 'title',
begin: '<',
end: '>'
}
{
className: 'title',
variants: [
{ begin: '\"', end: '\"' },
{ begin: '<', end: '>' }
]
}
]
},
{
className: 'preprocessor',
begin: '#',
end: '$'
},
{
className: 'class',
begin: '(' + CLASS_KEYWORDS.split(' ').join('|') + ')\\b', end: '({|$)',
begin: '(' + CLASS_KEYWORDS.split(' ').join('|') + ')\\b', end: '({|$)', excludeEnd: true,
keywords: CLASS_KEYWORDS, lexemes: LEXEMES,

@@ -76,0 +78,0 @@ contains: [

module.exports = function(hljs) {
return {
aliases: ['ml'],
keywords: {

@@ -12,3 +13,3 @@ keyword:

'bool char float int list unit array exn option int32 int64 nativeint ' +
'format4 format6 lazy_t in_channel out_channel string',
'format4 format6 lazy_t in_channel out_channel string'
},

@@ -28,3 +29,3 @@ illegal: /\/\//,

className: 'class',
beginKeywords: 'type', end: '\\(|=|$',
beginKeywords: 'type', end: '\\(|=|$', excludeEnd: true,
contains: [

@@ -31,0 +32,0 @@ hljs.UNDERSCORE_TITLE_MODE

module.exports = function(hljs) {
var OXYGENE_KEYWORDS = 'abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue '+
'create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false '+
'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited'+
' inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of '+
'old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly '+
'record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple '+
'type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal '+
'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained';
'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited '+
'inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of '+
'old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly '+
'record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple '+
'type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal '+
'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained';
var CURLY_COMMENT = {

@@ -11,0 +11,0 @@ className: 'comment',

@@ -34,4 +34,4 @@ module.exports = function(hljs) {

{begin: /\$\d/},
{begin: /[\$\%\@\*](\^\w\b|#\w+(\:\:\w+)*|{\w+}|\w+(\:\:\w*)*)/},
{begin: /[\$\%\@\*][^\s\w{]/, relevance: 0}
{begin: /[\$\%\@](\^\w\b|#\w+(\:\:\w+)*|{\w+}|\w+(\:\:\w*)*)/},
{begin: /[\$\%\@][^\s\w{]/, relevance: 0}
]

@@ -43,3 +43,3 @@ };

relevance: 5
}
};
var STRING_CONTAINS = [hljs.BACKSLASH_ESCAPE, SUBST, VAR];

@@ -146,2 +146,3 @@ var PERL_DEFAULT_CONTAINS = [

return {
aliases: ['pl'],
keywords: PERL_KEYWORDS,

@@ -148,0 +149,0 @@ contains: PERL_DEFAULT_CONTAINS

module.exports = function(hljs) {
var VARIABLE = {
className: 'variable', begin: '\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
className: 'variable', begin: '(\\$|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
};

@@ -24,2 +24,3 @@ var PREPROCESSOR = {

return {
aliases: ['php3', 'php4', 'php5', 'php6'],
case_insensitive: true,

@@ -63,3 +64,3 @@ keywords:

className: 'function',
beginKeywords: 'function', end: /[;{]/,
beginKeywords: 'function', end: /[;{]/, excludeEnd: true,
illegal: '\\$|\\[|%',

@@ -83,3 +84,3 @@ contains: [

className: 'class',
beginKeywords: 'class interface', end: '{',
beginKeywords: 'class interface', end: '{', excludeEnd: true,
illegal: /[:\(\$"]/,

@@ -86,0 +87,0 @@ contains: [

module.exports = function(hljs) {
var PROMPT = {
className: 'prompt', begin: /^(>>>|\.\.\.) /
}
};
var STRING = {

@@ -28,6 +28,6 @@ className: 'string',

{
begin: /(b|br)'/, end: /'/,
begin: /(b|br)'/, end: /'/
},
{
begin: /(b|br)"/, end: /"/,
begin: /(b|br)"/, end: /"/
},

@@ -45,3 +45,3 @@ hljs.APOS_STRING_MODE,

]
}
};
var PARAMS = {

@@ -59,2 +59,3 @@ className: 'params',

return {
aliases: ['py', 'gyp'],
keywords: {

@@ -61,0 +62,0 @@ keyword:

@@ -11,2 +11,6 @@ module.exports = function(hljs) {

};
var IRB_OBJECT = {
className: 'value',
begin: '#<', end: '>'
};
var COMMENT = {

@@ -43,23 +47,8 @@ className: 'comment',

{begin: '%[qw]?{', end: '}'},
{begin: '%[qw]?<', end: '>'},
{begin: '%[qw]?/', end: '/'},
{begin: '%[qw]?%', end: '%'},
{begin: '%[qw]?-', end: '-'},
{begin: '%[qw]?\\|', end: '\\|'},
{
begin: '%[qw]?<', end: '>',
relevance: 10
},
{
begin: '%[qw]?/', end: '/',
relevance: 10
},
{
begin: '%[qw]?%', end: '%',
relevance: 10
},
{
begin: '%[qw]?-', end: '-',
relevance: 10
},
{
begin: '%[qw]?\\|', end: '\\|',
relevance: 10
},
{
// \B in the beginning suppresses recognition of ?-sequences where ?

@@ -79,2 +68,3 @@ // is the last character of a preceding identifier, as in: `func?4`

STRING,
IRB_OBJECT,
COMMENT,

@@ -136,2 +126,3 @@ {

contains: [
IRB_OBJECT,
COMMENT,

@@ -156,7 +147,43 @@ {

PARAMS.contains = RUBY_DEFAULT_CONTAINS;
var IRB_DEFAULT = [
{
relevance: 1,
className: 'output',
begin: '^\\s*=> ', end: "$",
returnBegin: true,
contains: [
{
className: 'status',
begin: '^\\s*=>'
},
{
begin: ' ', end: '$',
contains: RUBY_DEFAULT_CONTAINS
}
]
},
{
relevance: 1,
className: 'input',
begin: '^[^ ][^=>]*>+ ', end: "$",
returnBegin: true,
contains: [
{
className: 'prompt',
begin: '^[^ ][^=>]*>+'
},
{
begin: ' ', end: '$',
contains: RUBY_DEFAULT_CONTAINS
}
]
}
];
return {
aliases: ['rb', 'gemspec', 'podspec', 'thor', 'irb'],
keywords: RUBY_KEYWORDS,
contains: RUBY_DEFAULT_CONTAINS
contains: IRB_DEFAULT.concat(RUBY_DEFAULT_CONTAINS)
};
};
module.exports = function(hljs) {
var NUMBER = {
className: 'number',
begin: '\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)',
relevance: 0
};
var KEYWORDS =
'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 {
keywords: KEYWORDS,
aliases: ['rs'],
keywords:
'alignof as be box break const continue crate do else enum extern ' +
'false fn for if impl in let loop match mod mut offsetof once priv ' +
'proc pub pure ref return self sizeof static struct super trait true ' +
'type typeof unsafe unsized use virtual while yield ' +
'int i8 i16 i32 i64 ' +
'uint u8 u32 u64 ' +
'float f32 f64 ' +
'str char bool',
illegal: '</',

@@ -20,7 +18,21 @@ contains: [

hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
hljs.APOS_STRING_MODE,
NUMBER,
{
className: 'string',
begin: /r(#*)".*?"\1(?!#)/
},
{
className: 'string',
begin: /'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/
},
{
begin: /'[a-zA-Z_][a-zA-Z0-9_]*/
},
{
className: 'number',
begin: '\\b(0[xb][A-Za-z0-9_]+|[0-9_]+(\\.[0-9_]+)?([uif](8|16|32|64)?)?)',
relevance: 0
},
{
className: 'function',
beginKeywords: 'fn', end: '(\\(|<)',
beginKeywords: 'fn', end: '(\\(|<)', excludeEnd: true,
contains: [hljs.UNDERSCORE_TITLE_MODE]

@@ -41,2 +53,8 @@ },

illegal: '\\S'
},
{
begin: hljs.IDENT_RE + '::'
},
{
begin: '->'
}

@@ -43,0 +61,0 @@ ]

@@ -10,2 +10,6 @@ module.exports = function(hljs) {

};
var SYMBOL = {
className: 'symbol',
begin: '\'\\w[\\w\\d_]*(?!\')'
};
return {

@@ -27,6 +31,8 @@ keywords:

hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE,
STRING, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE,
STRING, hljs.QUOTE_STRING_MODE,
SYMBOL,
{
className: 'class',
begin: '((case )?class |object |trait )', end: '({|$)', // beginKeywords won't work because a single "case" shouldn't start this mode
begin: '((case )?class |object |trait )', // beginKeywords won't work because a single "case" shouldn't start this mode
end: '({|$)', excludeEnd: true,
illegal: ':',

@@ -44,3 +50,3 @@ keywords: 'case class trait object',

contains: [
hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, STRING,
hljs.QUOTE_STRING_MODE, STRING,
ANNOTATION

@@ -47,0 +53,0 @@ ]

@@ -13,2 +13,3 @@ module.exports = function(hljs) {

return {
aliases: ['sci'],
keywords: {

@@ -37,4 +38,4 @@ keyword: 'abort break case clear catch continue do elseif else endfunction end for function'+

begin: '\\(', end: '\\)'
},
],
}
]
},

@@ -41,0 +42,0 @@ {

module.exports = function(hljs) {
var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*';
var VARIABLE = {
className: 'variable',
begin: '(\\$' + IDENT_RE + ')\\b'
};
var FUNCTION = {
className: 'function',
begin: IDENT_RE + '\\(', end: '\\)',
contains: ['self', hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE]
begin: IDENT_RE + '\\(',
returnBegin: true,
excludeEnd: true,
end: '\\('
};

@@ -22,3 +28,3 @@ var HEXCOLOR = {

HEXCOLOR,
hljs.NUMBER_MODE,
hljs.CSS_NUMBER_MODE,
hljs.QUOTE_STRING_MODE,

@@ -39,8 +45,4 @@ hljs.APOS_STRING_MODE,

hljs.C_BLOCK_COMMENT_MODE,
FUNCTION,
{
className: 'function',
begin: IDENT_RE + '\\(', end: '\\)',
contains: ['self', hljs.NUMBER_MODE, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE]
},
{
className: 'id', begin: '\\#[A-Za-z0-9_-]+',

@@ -71,2 +73,3 @@ relevance: 0

},
VARIABLE,
{

@@ -85,4 +88,6 @@ className: 'attribute',

contains: [
FUNCTION,
VARIABLE,
HEXCOLOR,
hljs.NUMBER_MODE,
hljs.CSS_NUMBER_MODE,
hljs.QUOTE_STRING_MODE,

@@ -101,6 +106,7 @@ hljs.APOS_STRING_MODE,

FUNCTION,
VARIABLE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
HEXCOLOR,
hljs.NUMBER_MODE,
hljs.CSS_NUMBER_MODE,
{

@@ -107,0 +113,0 @@ className: 'preprocessor',

@@ -12,2 +12,3 @@ module.exports = function(hljs) {

return {
aliases: ['st'],
keywords: 'self super nil true false thisContext', // only 6

@@ -14,0 +15,0 @@ contains: [

module.exports = function(hljs) {
var COMMENT_MODE = {
className: 'comment',
begin: '--', end: '$'
};
return {

@@ -8,27 +12,66 @@ case_insensitive: true,

className: 'operator',
begin: '\\b(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|merge)\\b(?!:)', // negative look-ahead here is specifically to prevent stomping on SmallTalk
end: ';', endsWithParent: true,
beginKeywords:
'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 '+
'merge describe use explain help declare prepare execute deallocate savepoint release '+
'unlock purge reset change stop analyze cache flush optimize repair kill '+
'install uninstall checksum restore check backup',
end: /;/, endsWithParent: true,
keywords: {
keyword: 'all partial global month current_timestamp using go revoke smallint ' +
'indicator end-exec disconnect zone with character assertion to add current_user ' +
'usage input local alter match collate real then rollback get read timestamp ' +
'session_user not integer bit unique day minute desc insert execute like ilike|2 ' +
'level decimal drop continue isolation found where constraints domain right ' +
'national some module transaction relative second connect escape close system_user ' +
'for deferred section cast current sqlstate allocate intersect deallocate numeric ' +
'public preserve full goto initially asc no key output collation group by union ' +
'session both last language constraint column of space foreign deferrable prior ' +
'connection unknown action commit view or first into float year primary cascaded ' +
'except restrict set references names table outer open select size are rows from ' +
'prepare distinct leading create only next inner authorization schema ' +
'corresponding option declare precision immediate else timezone_minute external ' +
'varying translation true case exception join hour default double scroll value ' +
'cursor descriptor values dec fetch procedure delete and false int is describe ' +
'char as at in varchar null trailing any absolute current_time end grant ' +
'privileges when cross check write current_date pad begin temporary exec time ' +
'update catalog user sql date on identity timezone_hour natural whenever interval ' +
'work order cascade diagnostics nchar having left call do handler load replace ' +
'truncate start lock show pragma exists number trigger if before after each row ' +
'merge matched database',
aggregate: 'count sum min max avg'
keyword:
'abs absolute acos action add adddate addtime aes_decrypt aes_encrypt after aggregate all allocate alter ' +
'analyze and any are as asc ascii asin assertion at atan atan2 atn2 authorization authors avg backup ' +
'before begin benchmark between bin binlog bit_and bit_count bit_length bit_or bit_xor both by ' +
'cache call cascade cascaded case cast catalog ceil ceiling chain change changed char_length ' +
'character_length charindex charset check checksum checksum_agg choose close coalesce ' +
'coercibility collate collation collationproperty column columns columns_updated commit compress concat ' +
'concat_ws concurrent connect connection connection_id consistent constraint constraints continue ' +
'contributors conv convert convert_tz corresponding cos cot count count_big crc32 create cross cume_dist ' +
'curdate current current_date current_time current_timestamp current_user cursor curtime data database ' +
'databases datalength date_add date_format date_sub dateadd datediff datefromparts datename ' +
'datepart datetime2fromparts datetimeoffsetfromparts day dayname dayofmonth dayofweek dayofyear ' +
'deallocate declare decode default deferrable deferred degrees delayed delete des_decrypt ' +
'des_encrypt des_key_file desc describe descriptor diagnostics difference disconnect distinct ' +
'distinctrow div do domain double drop dumpfile each else elt enclosed encode encrypt end end-exec ' +
'engine engines eomonth errors escape escaped event eventdata events except exception exec execute ' +
'exists exp explain export_set extended external extract fast fetch field fields find_in_set ' +
'first first_value floor flush for force foreign format found found_rows from from_base64 ' +
'from_days from_unixtime full function get get_format get_lock getdate getutcdate global go goto grant ' +
'grants greatest group group_concat grouping grouping_id gtid_subset gtid_subtract handler having help ' +
'hex high_priority hosts hour ident_current ident_incr ident_seed identified identity if ifnull ignore ' +
'iif ilike immediate in index indicator inet6_aton inet6_ntoa inet_aton inet_ntoa infile initially inner ' +
'innodb input insert install instr intersect into is is_free_lock is_ipv4 ' +
'is_ipv4_compat is_ipv4_mapped is_not is_not_null is_used_lock isdate isnull isolation join key kill ' +
'language last last_day last_insert_id last_value lcase lead leading least leaves left len lenght level ' +
'like limit lines ln load load_file local localtime localtimestamp locate lock log log10 log2 logfile ' +
'logs low_priority lower lpad ltrim make_set makedate maketime master master_pos_wait match matched max ' +
'md5 medium merge microsecond mid min minute mod mode module month monthname mutex name_const names ' +
'national natural nchar next no no_write_to_binlog not now nullif nvarchar oct ' +
'octet_length of old_password on only open optimize option optionally or ord order outer outfile output ' +
'pad parse partial partition password patindex percent_rank percentile_cont percentile_disc period_add ' +
'period_diff pi plugin position pow power pragma precision prepare preserve primary prior privileges ' +
'procedure procedure_analyze processlist profile profiles public publishingservername purge quarter ' +
'query quick quote quotename radians rand read references regexp relative relaylog release ' +
'release_lock rename repair repeat replace replicate reset restore restrict return returns reverse ' +
'revoke right rlike rollback rollup round row row_count rows rpad rtrim savepoint schema scroll ' +
'sec_to_time second section select serializable server session session_user set sha sha1 sha2 share ' +
'show sign sin size slave sleep smalldatetimefromparts snapshot some soname soundex ' +
'sounds_like space sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache ' +
'sql_small_result sql_variant_property sqlstate sqrt square start starting status std ' +
'stddev stddev_pop stddev_samp stdev stdevp stop str str_to_date straight_join strcmp string stuff ' +
'subdate substr substring subtime subtring_index sum switchoffset sysdate sysdatetime sysdatetimeoffset ' +
'system_user sysutcdatetime table tables tablespace tan temporary terminated tertiary_weights then time ' +
'time_format time_to_sec timediff timefromparts timestamp timestampadd timestampdiff timezone_hour ' +
'timezone_minute to to_base64 to_days to_seconds todatetimeoffset trailing transaction translation ' +
'trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse ucase uncompress ' +
'uncompressed_length unhex unicode uninstall union unique unix_timestamp unknown unlock update upgrade ' +
'upped upper usage use user user_resources using utc_date utc_time utc_timestamp uuid uuid_short ' +
'validate_password_strength value values var var_pop var_samp variables variance varp ' +
'version view warnings week weekday weekofyear weight_string when whenever where with work write xml ' +
'xor year yearweek zon',
literal:
'true false null',
built_in:
'array bigint binary bit blob boolean char character date dec decimal float int integer interval number ' +
'numeric real serial smallint varchar varying int8 serial8 text'
},

@@ -51,12 +94,11 @@ contains: [

},
hljs.C_NUMBER_MODE
hljs.C_NUMBER_MODE,
hljs.C_BLOCK_COMMENT_MODE,
COMMENT_MODE
]
},
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'comment',
begin: '--', end: '$'
}
COMMENT_MODE
]
};
};

@@ -26,3 +26,3 @@ module.exports = function(hljs) {

className: 'class',
beginKeywords: 'class interface delegate namespace', end: '{',
beginKeywords: 'class interface delegate namespace', end: '{', excludeEnd: true,
illegal: '[^,:\\n\\s\\.]',

@@ -29,0 +29,0 @@ contains: [

module.exports = function(hljs) {
return {
aliases: ['vb'],
case_insensitive: true,

@@ -38,3 +39,3 @@ keywords: {

begin: '</?', end: '>'
},
}
]

@@ -47,5 +48,5 @@ },

keywords: 'if else elseif end region externalsource'
},
}
]
};
};
module.exports = function(hljs) {
return {
aliases: ['vbs'],
case_insensitive: true,

@@ -4,0 +5,0 @@ keywords: {

@@ -35,3 +35,3 @@ module.exports = function(hljs) {

return {
aliases: ['html'],
aliases: ['html', 'xhtml', 'rss', 'atom', 'xsl', 'plist'],
case_insensitive: true,

@@ -38,0 +38,0 @@ contains: [

{
"engines": {
"node": "*"
},
"description": "Syntax highlighting with language autodetection.",
"keywords": [
"highlight",
"syntax"
],
"main": "./lib/index.js",
"version": "8.1.0",
"homepage": "http://highlightjs.org/",
"description": "Syntax highlighting with language autodetection.",
"bugs": {
"url": "https://github.com/isagalaev/highlight.js/issues"
},
"contributors": [

@@ -360,3 +360,3 @@ {

{
"email": "jan@idleberg.com",
"email": "git@idleberg.com",
"name": "Jan T. Sott"

@@ -375,9 +375,84 @@ },

"name": "Ilya Vassilevsky"
},
{
"email": "josh@isotope11.com",
"name": "Josh Adams"
},
{
"email": "daniel.tao@gmail.com",
"name": "Dan Tao"
},
{
"email": "hello@jenius.me",
"name": "Jeff Escalante"
},
{
"email": "yangjvn@126.com",
"name": "Jun Yang"
},
{
"email": "info@neor.ru",
"name": "Nikolay Lisienko"
},
{
"email": "post@auge8472.de",
"name": "Heiko August"
},
{
"email": "domen@dev.si",
"name": "Domen Kožar"
},
{
"email": "travis.a.odom@gmail.com",
"name": "Travis Odom"
},
{
"email": "innocenat@gmail.com",
"name": "innocenat"
},
{
"email": "devolonter@gmail.com",
"name": "Arthur Bikmullin"
},
{
"email": "phi@ruby-reactive.org",
"name": "Pascal Hurni"
},
{
"email": "romanshmatov@gmail.com",
"name": "Roman Shmatov"
},
{
"email": "nic@letolab.com",
"name": "Nic West"
},
{
"email": "panu.horsmalahti@iki.fi",
"name": "Panu Horsmalahti"
},
{
"email": "tamas.flaviu@gmail.com",
"name": "Flaviu Tamas"
},
{
"email": "mee.damian@gmail.com",
"name": "Damian Mee"
},
{
"email": "ikasoki@gmail.com",
"name": "Christopher Kaster"
},
{
"email": "chris@eidhof.nl",
"name": "Chris Eidhof"
},
{
"email": "natecook@gmail.com",
"name": "Nate Cook"
},
{
"email": "matt@diephouse.com",
"name": "Matt Diephouse"
}
],
"author": {
"email": "maniac@softwaremaniacs.org",
"name": "Ivan Sagalaev"
},
"version": "8.0.0",
"licenses": [

@@ -389,13 +464,18 @@ {

],
"name": "highlight.js",
"main": "./lib/index.js",
"scripts": {},
"keywords": [
"highlight",
"syntax"
],
"author": {
"email": "maniac@softwaremaniacs.org",
"name": "Ivan Sagalaev"
},
"repository": {
"url": "git://github.com/isagalaev/highlight.js.git",
"type": "git"
},
"scripts": {},
"name": "highlight.js",
"bugs": {
"url": "https://github.com/isagalaev/highlight.js/issues"
},
"engines": {
"node": "*"
}
}
# Highlight.js
Highlight.js highlights syntax in code examples on blogs, forums and,
in fact, on any web page. It's very easy to use because it works
automatically: finds blocks of code, detects a language, highlights it.
Highlight.js is a syntax highlighter written in JavaScript. It works in the
browser as well as on the server. It works with pretty much any markup,
doesn't depend on any framework and has automatic language detection.
Autodetection can be fine tuned when it fails by itself (see "Heuristics").
## Getting Started
## Basic usage
The bare minimum for using highlight.js on a web page is linking to the library
along with one of the styles and calling [`initHighlightingOnLoad`][1]:
Link the library and a stylesheet from your page and hook highlighting to
the page load event:
```html
<link rel="stylesheet" href="styles/default.css">
<script src="highlight.pack.js"></script>
<link rel="stylesheet" href="/path/to/styles/default.css">
<script src="/path/to/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
```
This will highlight all code on the page marked up as `<pre><code> .. </code></pre>`.
If you use different markup or need to apply highlighting dynamically, read
"Custom initialization" below.
This will find and highlight code inside of `<pre><code>` tags trying to detect
the language automatically. If automatic detection doesn't work for you, you can
specify the language in the class attribute:
- You can download your own customized version of "highlight.pack.js" or
use the hosted one as described on the download page:
<http://highlightjs.org/download/>
- Style themes are available in the download package or as hosted files.
To create a custom style for your site see the class reference in the file
[CSS classes reference][cr] from the downloaded package.
[cr]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html
## node.js
Highlight.js can be used under node.js. The package with all supported languages is
installable from NPM:
npm install highlight.js
Alternatively, you can build it from the source with only languages you need:
python3 tools/build.py -tnode lang1 lang2 ..
Using the library:
```javascript
var hljs = require('highlight.js');
// If you know the language
hljs.highlight(lang, code).value;
// Automatic language detection
hljs.highlightAuto(code).value;
```html
<pre><code class="html">...</code></pre>
```
The list of supported language classes is available in the [class reference][8].
Classes can also be prefixed with either `language-` or `lang-`.
## AMD
To disable highlighting altogether use the `no-highlight` class:
Highlight.js can be used with an AMD loader. You will need to build it from
source in order to do so:
```bash
$ python3 tools/build.py -tamd lang1 lang2 ..
```
Which will generate a `build/highlight.pack.js` which will load as an AMD
module with support for the built languages and can be used like so:
```javascript
require(["highlight.js/build/highlight.pack"], function(hljs){
// If you know the language
hljs.highlight(lang, code).value;
// Automatic language detection
hljs.highlightAuto(code).value;
});
```
## Tab replacement
You can replace TAB ('\x09') characters used for indentation in your code
with some fixed number of spaces or with a `<span>` to give them special
styling:
```html
<script type="text/javascript">
hljs.configure({tabReplace: ' '}); // 4 spaces
// ... or
hljs.configure({tabReplace: '<span class="indent">\t</span>'});
hljs.initHighlightingOnLoad();
</script>
<pre><code class="no-highlight">...</code></pre>
```
## Custom initialization
## Custom Initialization
If you use different markup for code blocks you can initialize them manually
with `highlightBlock(code)` function. It takes a DOM element containing the
code to highlight and optionally a string with which to replace TAB
characters.
When you need a bit more control over the initialization of
highlight.js, you can use the [`highlightBlock`][2] and [`configure`][3]
functions. This allows you to control *what* to highlight and *when*.
Initialization using, for example, jQuery might look like this:
Here's an equivalent way to calling [`initHighlightingOnLoad`][1] using jQuery:
```javascript
$(document).ready(function() {
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
});
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
};)
```
You can use `highlightBlock` to highlight blocks dynamically inserted into
the page. Just make sure you don't do it twice for already highlighted
blocks.
You can use any tags instead of `<pre><code>` to mark up your code. If you don't
use a container that preserve line breaks you will need to configure
highlight.js to use the `<br>` tag:
If your code container relies on `<br>` tags instead of line breaks (i.e. if
it's not `<pre>`) set the `useBR` option to `true`:
```javascript
hljs.configure({useBR: true});
$('div.code').each(function(i, e) {hljs.highlightBlock(e)});
$('div.code').each(function(i, block) {
hljs.highlightBlock(block);
});
```
For other options refer to the documentation for [`configure`][3].
## Heuristics
Autodetection of a code's language is done using a simple heuristic:
the program tries to highlight a fragment with all available languages and
counts all syntactic structures that it finds along the way. The language
with greatest count wins.
## Getting the Library
This means that in short fragments the probability of an error is high
(and it really happens sometimes). In this cases you can set the fragment's
language explicitly by assigning a class to the `<code>` element:
You can get highlight.js as a hosted or custom-build browser script or as a
server module. Head over to the [download page][4] for all the options.
```html
<pre><code class="html">...</code></pre>
```
Note, that the library is not supposed to work straight from the source on
GitHub, it requires building. If none of the pre-packaged options work for you
refer to the [building documentation][5].
You can use class names recommended in HTML5: "language-html",
"language-php". Classes also can be assigned to the `<pre>` element.
To disable highlighting of a fragment altogether use "no-highlight" class:
## License
```html
<pre><code class="no-highlight">...</code></pre>
```
Highlight.js is released under the BSD License. See [LICENSE][10] file for
details.
## Export
## Links
File export.html contains a little program that allows you to paste in a code
snippet and then copy and paste the resulting HTML code generated by the
highlighter. This is useful in situations when you can't use the script itself
on a site.
The official site for the library is at <http://highlightjs.org/>.
Further in-depth documentation for the API and other topics is at
<http://highlightjs.readthedocs.org/>.
## Meta
Authors and contributors are listed in the [AUTHORS.en.txt][9] file.
- Version: 8.0
- URL: http://highlightjs.org/
For the license terms see LICENSE files.
For authors and contributors see AUTHORS.en.txt file.
[1]: http://highlightjs.readthedocs.org/en/latest/api.html#inithighlightingonload
[2]: http://highlightjs.readthedocs.org/en/latest/api.html#highlightblock-block
[3]: http://highlightjs.readthedocs.org/en/latest/api.html#configure-options
[4]: http://highlightjs.org/download/
[5]: http://highlightjs.readthedocs.org/en/latest/building-testing.html
[8]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html
[9]: https://github.com/isagalaev/highlight.js/blob/master/AUTHORS.en.txt
[10]: https://github.com/isagalaev/highlight.js/blob/master/LICENSE
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc