Socket
Socket
Sign inDemoInstall

highlight.js

Package Overview
Dependencies
0
Maintainers
6
Versions
100
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 10.4.1 to 10.5.0

lib/languages/sql_more.js

1

lib/index.js

@@ -167,2 +167,3 @@ var hljs = require('./core');

hljs.registerLanguage('sqf', require('./languages/sqf'));
hljs.registerLanguage('sql_more', require('./languages/sql_more'));
hljs.registerLanguage('sql', require('./languages/sql'));

@@ -169,0 +170,0 @@ hljs.registerLanguage('stan', require('./languages/stan'));

@@ -0,1 +1,26 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*

@@ -5,2 +30,3 @@ Language: Augmented Backus-Naur Form

Website: https://tools.ietf.org/html/rfc5234
Audit: 2020
*/

@@ -11,4 +37,4 @@

const regexes = {
ruleDeclaration: "^[a-zA-Z][a-zA-Z0-9-]*",
unexpectedChars: "[!@#$^&',?+~`|:]"
ruleDeclaration: /^[a-zA-Z][a-zA-Z0-9-]*/,
unexpectedChars: /[!@#$^&',?+~`|:]/
};

@@ -35,3 +61,3 @@

const commentMode = hljs.COMMENT(";", "$");
const commentMode = hljs.COMMENT(/;/, /$/);

@@ -60,3 +86,3 @@ const terminalBinaryMode = {

className: "attribute",
begin: regexes.ruleDeclaration + '(?=\\s*=)'
begin: concat(regexes.ruleDeclaration, /(?=\s*=)/)
};

@@ -63,0 +89,0 @@

86

lib/languages/accesslog.js

@@ -0,1 +1,38 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] } args
* @returns {string}
*/
function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*

@@ -6,9 +43,18 @@ Language: Apache Access Log

Website: https://httpd.apache.org/docs/2.4/logs.html#accesslog
Audit: 2020
*/
/** @type LanguageFn */
function accesslog(hljs) {
function accesslog(_hljs) {
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
const HTTP_VERBS = [
"GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "PATCH", "TRACE"
"GET",
"POST",
"HEAD",
"PUT",
"DELETE",
"CONNECT",
"OPTIONS",
"PATCH",
"TRACE"
];

@@ -21,3 +67,3 @@ return {

className: 'number',
begin: '^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b',
begin: /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?\b/,
relevance: 5

@@ -28,3 +74,3 @@ },

className: 'number',
begin: '\\b\\d+\\b',
begin: /\b\d+\b/,
relevance: 0

@@ -35,11 +81,13 @@ },

className: 'string',
begin: '"(' + HTTP_VERBS.join("|") + ')',
end: '"',
begin: concat(/"/, either(...HTTP_VERBS)),
end: /"/,
keywords: HTTP_VERBS.join(" "),
illegal: '\\n',
illegal: /\n/,
relevance: 5,
contains: [{
begin: 'HTTP/[12]\\.\\d',
relevance: 5
}]
contains: [
{
begin: /HTTP\/[12]\.\d'/,
relevance: 5
}
]
},

@@ -53,3 +101,3 @@ // Dates

begin: /\[\d[^\]\n]{8,}\]/,
illegal: '\\n',
illegal: /\n/,
relevance: 1

@@ -61,3 +109,3 @@ },

end: /\]/,
illegal: '\\n',
illegal: /\n/,
relevance: 0

@@ -68,5 +116,5 @@ },

className: 'string',
begin: '"Mozilla/\\d\\.\\d \\(',
end: '"',
illegal: '\\n',
begin: /"Mozilla\/\d\.\d \(/,
end: /"/,
illegal: /\n/,
relevance: 3

@@ -77,5 +125,5 @@ },

className: 'string',
begin: '"',
end: '"',
illegal: '\\n',
begin: /"/,
end: /"/,
illegal: /\n/,
relevance: 0

@@ -82,0 +130,0 @@ }

@@ -0,1 +1,26 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*

@@ -5,2 +30,3 @@ Language: ActionScript

Category: scripting
Audit: 2020
*/

@@ -10,8 +36,8 @@

function actionscript(hljs) {
const IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*';
const IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)';
const IDENT_RE = /[a-zA-Z_$][a-zA-Z0-9_$]*/;
const IDENT_FUNC_RETURN_TYPE_RE = /([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)/;
const AS3_REST_ARG_MODE = {
className: 'rest_arg',
begin: '[.]{3}',
begin: /[.]{3}/,
end: IDENT_RE,

@@ -23,3 +49,3 @@ relevance: 10

name: 'ActionScript',
aliases: ['as'],
aliases: [ 'as' ],
keywords: {

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

end: /\{/,
contains: [hljs.TITLE_MODE]
contains: [ hljs.TITLE_MODE ]
},

@@ -59,3 +85,3 @@ {

beginKeywords: 'import include',
end: ';',
end: /;/,
keywords: { 'meta-keyword': 'import include' }

@@ -66,5 +92,5 @@ },

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

@@ -74,4 +100,4 @@ hljs.TITLE_MODE,

className: 'params',
begin: '\\(',
end: '\\)',
begin: /\(/,
end: /\)/,
contains: [

@@ -85,3 +111,3 @@ hljs.APOS_STRING_MODE,

},
{ begin: ':\\s*' + IDENT_FUNC_RETURN_TYPE_RE }
{ begin: concat(/:\s*/, IDENT_FUNC_RETURN_TYPE_RE) }
]

@@ -88,0 +114,0 @@ },

@@ -8,2 +8,3 @@ /*

Category: common, config
Audit: 2020
*/

@@ -15,19 +16,19 @@

className: 'number',
begin: '[\\$%]\\d+'
begin: /[$%]\d+/
};
const NUMBER = {
className: 'number',
begin: '\\d+'
begin: /\d+/
};
const IP_ADDRESS = {
className: "number",
begin: '\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?'
begin: /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?/
};
const PORT_NUMBER = {
className: "number",
begin: ":\\d{1,5}"
begin: /:\d{1,5}/
};
return {
name: 'Apache config',
aliases: ['apacheconf'],
aliases: [ 'apacheconf' ],
case_insensitive: true,

@@ -38,4 +39,4 @@ contains: [

className: 'section',
begin: '</?',
end: '>',
begin: /<\/?/,
end: />/,
contains: [

@@ -55,6 +56,8 @@ IP_ADDRESS,

// for a very generally defined mode (starts with a word, ends with line-end
keywords: { nomarkup:
keywords: {
nomarkup:
'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' +
'sethandler errordocument loadmodule options header listen serverroot ' +
'servername' },
'servername'
},
starts: {

@@ -67,11 +70,13 @@ end: /$/,

className: 'meta',
begin: '\\s\\[',
end: '\\]$'
begin: /\s\[/,
end: /\]$/
},
{
className: 'variable',
begin: '[\\$%]\\{',
end: '\\}',
contains: ['self',
NUMBER_REF]
begin: /[\$%]\{/,
end: /\}/,
contains: [
'self',
NUMBER_REF
]
},

@@ -78,0 +83,0 @@ IP_ADDRESS,

@@ -0,1 +1,38 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] } args
* @returns {string}
*/
function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*

@@ -6,2 +43,3 @@ Language: AppleScript

Website: https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html
Audit: 2020
*/

@@ -11,9 +49,10 @@

function applescript(hljs) {
const STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {
illegal: ''
});
const STRING = hljs.inherit(
hljs.QUOTE_STRING_MODE, {
illegal: null
});
const PARAMS = {
className: 'params',
begin: '\\(',
end: '\\)',
begin: /\(/,
end: /\)/,
contains: [

@@ -25,6 +64,6 @@ 'self',

};
const COMMENT_MODE_1 = hljs.COMMENT('--', '$');
const COMMENT_MODE_1 = hljs.COMMENT(/--/, /$/);
const COMMENT_MODE_2 = hljs.COMMENT(
'\\(\\*',
'\\*\\)',
/\(\*/,
/\*\)/,
{

@@ -43,5 +82,47 @@ contains: [

const KEYWORD_PATTERNS = [
/apart from/,
/aside from/,
/instead of/,
/out of/,
/greater than/,
/isn't|(doesn't|does not) (equal|come before|come after|contain)/,
/(greater|less) than( or equal)?/,
/(starts?|ends|begins?) with/,
/contained by/,
/comes (before|after)/,
/a (ref|reference)/,
/POSIX (file|path)/,
/(date|time) string/,
/quoted form/
];
const BUILT_IN_PATTERNS = [
/clipboard info/,
/the clipboard/,
/info for/,
/list (disks|folder)/,
/mount volume/,
/path to/,
/(close|open for) access/,
/(get|set) eof/,
/current date/,
/do shell script/,
/get volume settings/,
/random number/,
/set volume/,
/system attribute/,
/system info/,
/time to GMT/,
/(load|run|store) script/,
/scripting components/,
/ASCII (character|number)/,
/localized string/,
/choose (application|color|file|file name|folder|from list|remote application|URL)/,
/display (alert|dialog)/
];
return {
name: 'AppleScript',
aliases: ['osascript'],
aliases: [ 'osascript' ],
keywords: {

@@ -75,30 +156,28 @@ keyword:

className: 'built_in',
begin:
'\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +
'mount volume|path to|(close|open for) access|(get|set) eof|' +
'current date|do shell script|get volume settings|random number|' +
'set volume|system attribute|system info|time to GMT|' +
'(load|run|store) script|scripting components|' +
'ASCII (character|number)|localized string|' +
'choose (application|color|file|file name|' +
'folder|from list|remote application|URL)|' +
'display (alert|dialog))\\b|^\\s*return\\b'
begin: concat(
/\b/,
either(...BUILT_IN_PATTERNS),
/\b/
)
},
{
className: 'built_in',
begin: /^\s*return\b/
},
{
className: 'literal',
begin:
'\\b(text item delimiters|current application|missing value)\\b'
/\b(text item delimiters|current application|missing value)\b/
},
{
className: 'keyword',
begin:
'\\b(apart from|aside from|instead of|out of|greater than|' +
"isn't|(doesn't|does not) (equal|come before|come after|contain)|" +
'(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +
'contained by|comes (before|after)|a (ref|reference)|POSIX file|' +
'POSIX path|(date|time) string|quoted form)\\b'
begin: concat(
/\b/,
either(...KEYWORD_PATTERNS),
/\b/
)
},
{
beginKeywords: 'on',
illegal: '[${=;\\n]',
illegal: /[${=;\n]/,
contains: [

@@ -108,5 +187,6 @@ hljs.UNDERSCORE_TITLE_MODE,

]
}
].concat(COMMENTS),
illegal: '//|->|=>|\\[\\['
},
...COMMENTS
],
illegal: /\/\/|->|=>|\[\[/
};

@@ -113,0 +193,0 @@ }

@@ -96,3 +96,3 @@ /**

{
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)'
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)'
},

@@ -214,3 +214,3 @@ {

keywords: CPP_KEYWORDS,
illegal: /[^\w\s\*&:<>]/,
illegal: /[^\w\s\*&:<>.]/,
contains: [

@@ -217,0 +217,0 @@ { // to prevent it from being confused as the function title

@@ -0,1 +1,26 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*

@@ -12,2 +37,112 @@ Language: AsciiDoc

function asciidoc(hljs) {
const HORIZONTAL_RULE = {
begin: '^\'{3,}[ \\t]*$',
relevance: 10
};
const ESCAPED_FORMATTING = [
// escaped constrained formatting marks (i.e., \* \_ or \`)
{
begin: /\\[*_`]/
},
// escaped unconstrained formatting marks (i.e., \\** \\__ or \\``)
// must ignore until the next formatting marks
// this rule might not be 100% compliant with Asciidoctor 2.0 but we are entering undefined behavior territory...
{
begin: /\\\\\*{2}[^\n]*?\*{2}/
},
{
begin: /\\\\_{2}[^\n]*_{2}/
},
{
begin: /\\\\`{2}[^\n]*`{2}/
},
// guard: constrained formatting mark may not be preceded by ":", ";" or
// "}". match these so the constrained rule doesn't see them
{
begin: /[:;}][*_`](?![*_`])/
}
];
const STRONG = [
// inline unconstrained strong (single line)
{
className: 'strong',
begin: /\*{2}([^\n]+?)\*{2}/
},
// inline unconstrained strong (multi-line)
{
className: 'strong',
begin: concat(
/\*\*/,
/((\*(?!\*)|\\[^\n]|[^*\n\\])+\n)+/,
/(\*(?!\*)|\\[^\n]|[^*\n\\])*/,
/\*\*/
),
relevance: 0
},
// inline constrained strong (single line)
{
className: 'strong',
// must not precede or follow a word character
begin: /\B\*(\S|\S[^\n]*?\S)\*(?!\w)/
},
// inline constrained strong (multi-line)
{
className: 'strong',
// must not precede or follow a word character
begin: /\*[^\s]([^\n]+\n)+([^\n]+)\*/
}
];
const EMPHASIS = [
// inline unconstrained emphasis (single line)
{
className: 'emphasis',
begin: /_{2}([^\n]+?)_{2}/
},
// inline unconstrained emphasis (multi-line)
{
className: 'emphasis',
begin: concat(
/__/,
/((_(?!_)|\\[^\n]|[^_\n\\])+\n)+/,
/(_(?!_)|\\[^\n]|[^_\n\\])*/,
/__/
),
relevance: 0
},
// inline constrained emphasis (single line)
{
className: 'emphasis',
// must not precede or follow a word character
begin: /\b_(\S|\S[^\n]*?\S)_(?!\w)/
},
// inline constrained emphasis (multi-line)
{
className: 'emphasis',
// must not precede or follow a word character
begin: /_[^\s]([^\n]+\n)+([^\n]+)_/
},
// inline constrained emphasis using single quote (legacy)
{
className: 'emphasis',
// must not follow a word character or be followed by a single quote or space
begin: '\\B\'(?![\'\\s])',
end: '(\\n{2}|\')',
// allow escaped single quote followed by word char
contains: [{
begin: '\\\\\'\\w',
relevance: 0
}],
relevance: 0
}
];
const ADMONITION = {
className: 'symbol',
begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+',
relevance: 10
};
const BULLET_LIST = {
className: 'bullet',
begin: '^(\\*+|-+|\\.+|[^\\n]+?::)\\s+'
};
return {

@@ -53,3 +188,3 @@ name: 'AsciiDoc',

{
begin: '^(={1,5}) .+?( \\1)?$'
begin: '^(={1,6})[ \t].+?([ \t]\\1)?$'
},

@@ -101,46 +236,9 @@ {

},
// lists (can only capture indicators)
{
className: 'bullet',
begin: '^(\\*+|-+|\\.+|[^\\n]+?::)\\s+'
},
// admonition
{
className: 'symbol',
begin: '^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+',
relevance: 10
},
// inline strong
{
className: 'strong',
// must not follow a word character or be followed by an asterisk or space
begin: '\\B\\*(?![\\*\\s])',
end: '(\\n{2}|\\*)',
// allow escaped asterisk followed by word char
contains: [{
begin: '\\\\*\\w',
relevance: 0
}]
},
// inline emphasis
{
className: 'emphasis',
// must not follow a word character or be followed by a single quote or space
begin: '\\B\'(?![\'\\s])',
end: '(\\n{2}|\')',
// allow escaped single quote followed by word char
contains: [{
begin: '\\\\\'\\w',
relevance: 0
}],
relevance: 0
},
// inline emphasis (alt)
{
className: 'emphasis',
// must not follow a word character or be followed by an underline or space
begin: '_(?![_\\s])',
end: '(\\n{2}|_)',
relevance: 0
},
BULLET_LIST,
ADMONITION,
...ESCAPED_FORMATTING,
...STRONG,
...EMPHASIS,
// inline smart quotes

@@ -158,2 +256,8 @@ {

},
// inline unconstrained emphasis
{
className: 'code',
begin: /`{2}/,
end: /(\n{2}|`{2})/
},
// inline code snippets (TODO should get same treatment as strong and emphasis)

@@ -172,7 +276,3 @@ {

},
// horizontal rules
{
begin: '^\'{3,}[ \\t]*$',
relevance: 10
},
HORIZONTAL_RULE,
// images and links

@@ -179,0 +279,0 @@ {

@@ -0,1 +1,26 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*

@@ -6,7 +31,9 @@ Language: AspectJ

Description: Syntax Highlighting for the AspectJ Language which is a general-purpose aspect-oriented extension to the Java programming language.
*/
Audit: 2020
*/
/** @type LanguageFn */
function aspectj(hljs) {
const KEYWORDS = 'false synchronized int abstract float private char boolean static null if const ' +
const KEYWORDS =
'false synchronized int abstract float private char boolean static null if const ' +
'for true while long throw strictfp finally protected import native final return void ' +

@@ -27,4 +54,4 @@ 'enum else extends implements break transient new catch instanceof byte super volatile case ' +

hljs.COMMENT(
'/\\*\\*',
'\\*/',
/\/\*\*/,
/\*\//,
{

@@ -40,3 +67,3 @@ relevance: 0,

className: 'doctag',
begin: '@[A-Za-z]+'
begin: /@[A-Za-z]+/
}

@@ -90,7 +117,9 @@ ]

illegal: /["\[\]]/,
contains: [{
begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
returnBegin: true,
contains: [hljs.UNDERSCORE_TITLE_MODE]
}]
contains: [
{
begin: concat(hljs.UNDERSCORE_IDENT_RE, /\s*\(/),
returnBegin: true,
contains: [ hljs.UNDERSCORE_TITLE_MODE ]
}
]
},

@@ -107,3 +136,3 @@ {

{
begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
begin: concat(hljs.UNDERSCORE_IDENT_RE, /\s*\(/),
keywords: KEYWORDS + ' ' + SHORTKEYS,

@@ -130,6 +159,6 @@ relevance: 0

{
begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
begin: concat(hljs.UNDERSCORE_IDENT_RE, /\s*\(/),
returnBegin: true,
relevance: 0,
contains: [hljs.UNDERSCORE_TITLE_MODE]
contains: [ hljs.UNDERSCORE_TITLE_MODE ]
},

@@ -157,3 +186,3 @@ {

className: 'meta',
begin: '@[A-Za-z]+'
begin: /@[A-Za-z]+/
}

@@ -160,0 +189,0 @@ ]

@@ -96,3 +96,3 @@ /**

{
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)'
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)'
},

@@ -214,3 +214,3 @@ {

keywords: CPP_KEYWORDS,
illegal: /[^\w\s\*&:<>]/,
illegal: /[^\w\s\*&:<>.]/,
contains: [

@@ -217,0 +217,0 @@ { // to prevent it from being confused as the function title

@@ -96,3 +96,3 @@ /**

{
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)'
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)'
},

@@ -214,3 +214,3 @@ {

keywords: CPP_KEYWORDS,
illegal: /[^\w\s\*&:<>]/,
illegal: /[^\w\s\*&:<>.]/,
contains: [

@@ -217,0 +217,0 @@ { // to prevent it from being confused as the function title

@@ -96,3 +96,3 @@ /**

{
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)'
begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)'
},

@@ -214,3 +214,3 @@ {

keywords: CPP_KEYWORDS,
illegal: /[^\w\s\*&:<>]/,
illegal: /[^\w\s\*&:<>.]/,
contains: [

@@ -217,0 +217,0 @@ { // to prevent it from being confused as the function title

@@ -9,8 +9,8 @@ /*

function crystal(hljs) {
var INT_SUFFIX = '(_?[ui](8|16|32|64|128))?';
var FLOAT_SUFFIX = '(_?f(32|64))?';
var CRYSTAL_IDENT_RE = '[a-zA-Z_]\\w*[!?=]?';
var CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|[=!]~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?';
var CRYSTAL_PATH_RE = '[A-Za-z_]\\w*(::\\w+)*(\\?|!)?';
var CRYSTAL_KEYWORDS = {
const INT_SUFFIX = '(_?[ui](8|16|32|64|128))?';
const FLOAT_SUFFIX = '(_?f(32|64))?';
const CRYSTAL_IDENT_RE = '[a-zA-Z_]\\w*[!?=]?';
const CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|[=!]~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?';
const CRYSTAL_PATH_RE = '[A-Za-z_]\\w*(::\\w+)*(\\?|!)?';
const CRYSTAL_KEYWORDS = {
$pattern: CRYSTAL_IDENT_RE,

@@ -24,12 +24,19 @@ keyword:

};
var SUBST = {
const SUBST = {
className: 'subst',
begin: /#\{/, end: /\}/,
begin: /#\{/,
end: /\}/,
keywords: CRYSTAL_KEYWORDS
};
var EXPANSION = {
const EXPANSION = {
className: 'template-variable',
variants: [
{begin: '\\{\\{', end: '\\}\\}'},
{begin: '\\{%', end: '%\\}'}
{
begin: '\\{\\{',
end: '\\}\\}'
},
{
begin: '\\{%',
end: '%\\}'
}
],

@@ -40,36 +47,97 @@ keywords: CRYSTAL_KEYWORDS

function recursiveParen(begin, end) {
var
contains = [{begin: begin, end: end}];
const
contains = [
{
begin: begin,
end: end
}
];
contains[0].contains = contains;
return contains;
}
var STRING = {
const STRING = {
className: 'string',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
contains: [
hljs.BACKSLASH_ESCAPE,
SUBST
],
variants: [
{begin: /'/, end: /'/},
{begin: /"/, end: /"/},
{begin: /`/, end: /`/},
{begin: '%[Qwi]?\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
{begin: '%[Qwi]?\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
{begin: '%[Qwi]?\\{', end: /\}/, contains: recursiveParen(/\{/, /\}/)},
{begin: '%[Qwi]?<', end: '>', contains: recursiveParen('<', '>')},
{begin: '%[Qwi]?\\|', end: '\\|'},
{begin: /<<-\w+$/, end: /^\s*\w+$/},
{
begin: /'/,
end: /'/
},
{
begin: /"/,
end: /"/
},
{
begin: /`/,
end: /`/
},
{
begin: '%[Qwi]?\\(',
end: '\\)',
contains: recursiveParen('\\(', '\\)')
},
{
begin: '%[Qwi]?\\[',
end: '\\]',
contains: recursiveParen('\\[', '\\]')
},
{
begin: '%[Qwi]?\\{',
end: /\}/,
contains: recursiveParen(/\{/, /\}/)
},
{
begin: '%[Qwi]?<',
end: '>',
contains: recursiveParen('<', '>')
},
{
begin: '%[Qwi]?\\|',
end: '\\|'
},
{
begin: /<<-\w+$/,
end: /^\s*\w+$/
}
],
relevance: 0,
relevance: 0
};
var Q_STRING = {
const Q_STRING = {
className: 'string',
variants: [
{begin: '%q\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
{begin: '%q\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
{begin: '%q\\{', end: /\}/, contains: recursiveParen(/\{/, /\}/)},
{begin: '%q<', end: '>', contains: recursiveParen('<', '>')},
{begin: '%q\\|', end: '\\|'},
{begin: /<<-'\w+'$/, end: /^\s*\w+$/},
{
begin: '%q\\(',
end: '\\)',
contains: recursiveParen('\\(', '\\)')
},
{
begin: '%q\\[',
end: '\\]',
contains: recursiveParen('\\[', '\\]')
},
{
begin: '%q\\{',
end: /\}/,
contains: recursiveParen(/\{/, /\}/)
},
{
begin: '%q<',
end: '>',
contains: recursiveParen('<', '>')
},
{
begin: '%q\\|',
end: '\\|'
},
{
begin: /<<-'\w+'$/,
end: /^\s*\w+$/
}
],
relevance: 0,
relevance: 0
};
var REGEXP = {
const REGEXP = {
begin: '(?!%\\})(' + hljs.RE_STARTERS_RE + '|\\n|\\b(case|if|select|unless|until|when|while)\\b)\\s*',

@@ -80,6 +148,15 @@ keywords: 'case if select unless until when while',

className: 'regexp',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
contains: [
hljs.BACKSLASH_ESCAPE,
SUBST
],
variants: [
{begin: '//[a-z]*', relevance: 0},
{begin: '/(?!\\/)', end: '/[a-z]*'},
{
begin: '//[a-z]*',
relevance: 0
},
{
begin: '/(?!\\/)',
end: '/[a-z]*'
}
]

@@ -90,22 +167,47 @@ }

};
var REGEXP2 = {
const REGEXP2 = {
className: 'regexp',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
contains: [
hljs.BACKSLASH_ESCAPE,
SUBST
],
variants: [
{begin: '%r\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},
{begin: '%r\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},
{begin: '%r\\{', end: /\}/, contains: recursiveParen(/\{/, /\}/)},
{begin: '%r<', end: '>', contains: recursiveParen('<', '>')},
{begin: '%r\\|', end: '\\|'},
{
begin: '%r\\(',
end: '\\)',
contains: recursiveParen('\\(', '\\)')
},
{
begin: '%r\\[',
end: '\\]',
contains: recursiveParen('\\[', '\\]')
},
{
begin: '%r\\{',
end: /\}/,
contains: recursiveParen(/\{/, /\}/)
},
{
begin: '%r<',
end: '>',
contains: recursiveParen('<', '>')
},
{
begin: '%r\\|',
end: '\\|'
}
],
relevance: 0
};
var ATTRIBUTE = {
const ATTRIBUTE = {
className: 'meta',
begin: '@\\[', end: '\\]',
begin: '@\\[',
end: '\\]',
contains: [
hljs.inherit(hljs.QUOTE_STRING_MODE, {className: 'meta-string'})
hljs.inherit(hljs.QUOTE_STRING_MODE, {
className: 'meta-string'
})
]
};
var CRYSTAL_DEFAULT_CONTAINS = [
const CRYSTAL_DEFAULT_CONTAINS = [
EXPANSION,

@@ -120,8 +222,13 @@ STRING,

className: 'class',
beginKeywords: 'class module struct', end: '$|;',
beginKeywords: 'class module struct',
end: '$|;',
illegal: /=/,
contains: [
hljs.HASH_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, {begin: CRYSTAL_PATH_RE}),
{begin: '<'} // relevance booster for inheritance
hljs.inherit(hljs.TITLE_MODE, {
begin: CRYSTAL_PATH_RE
}),
{ // relevance booster for inheritance
begin: '<'
}
]

@@ -131,22 +238,28 @@ },

className: 'class',
beginKeywords: 'lib enum union', end: '$|;',
beginKeywords: 'lib enum union',
end: '$|;',
illegal: /=/,
contains: [
hljs.HASH_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, {begin: CRYSTAL_PATH_RE}),
],
relevance: 10
hljs.inherit(hljs.TITLE_MODE, {
begin: CRYSTAL_PATH_RE
})
]
},
{
beginKeywords: 'annotation', end: '$|;',
beginKeywords: 'annotation',
end: '$|;',
illegal: /=/,
contains: [
hljs.HASH_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, {begin: CRYSTAL_PATH_RE}),
hljs.inherit(hljs.TITLE_MODE, {
begin: CRYSTAL_PATH_RE
})
],
relevance: 10
relevance: 2
},
{
className: 'function',
beginKeywords: 'def', end: /\B\b/,
beginKeywords: 'def',
end: /\B\b/,
contains: [

@@ -161,3 +274,4 @@ hljs.inherit(hljs.TITLE_MODE, {

className: 'function',
beginKeywords: 'fun macro', end: /\B\b/,
beginKeywords: 'fun macro',
end: /\B\b/,
contains: [

@@ -179,3 +293,8 @@ hljs.inherit(hljs.TITLE_MODE, {

begin: ':',
contains: [STRING, {begin: CRYSTAL_METHOD_RE}],
contains: [
STRING,
{
begin: CRYSTAL_METHOD_RE
}
],
relevance: 0

@@ -186,7 +305,17 @@ },

variants: [
{ begin: '\\b0b([01_]+)' + INT_SUFFIX },
{ begin: '\\b0o([0-7_]+)' + INT_SUFFIX },
{ begin: '\\b0x([A-Fa-f0-9_]+)' + INT_SUFFIX },
{ begin: '\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_?[-+]?[0-9_]*)?' + FLOAT_SUFFIX + '(?!_)' },
{ begin: '\\b([1-9][0-9_]*|0)' + INT_SUFFIX }
{
begin: '\\b0b([01_]+)' + INT_SUFFIX
},
{
begin: '\\b0o([0-7_]+)' + INT_SUFFIX
},
{
begin: '\\b0x([A-Fa-f0-9_]+)' + INT_SUFFIX
},
{
begin: '\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_?[-+]?[0-9_]*)?' + FLOAT_SUFFIX + '(?!_)'
},
{
begin: '\\b([1-9][0-9_]*|0)' + INT_SUFFIX
}
],

@@ -201,3 +330,3 @@ relevance: 0

name: 'Crystal',
aliases: ['cr'],
aliases: [ 'cr' ],
keywords: CRYSTAL_KEYWORDS,

@@ -204,0 +333,0 @@ contains: CRYSTAL_DEFAULT_CONTAINS

@@ -155,4 +155,5 @@ /*

hljs.COMMENT(
'/\\*\\*',
'\\*/', {
/\/\*\*(?!\/)/,
/\*\//,
{
subLanguage: 'markdown',

@@ -163,4 +164,4 @@ relevance: 0

hljs.COMMENT(
'///+\\s*',
'$', {
/\/{3,} ?/,
/$/, {
contains: [{

@@ -167,0 +168,0 @@ subLanguage: 'markdown',

@@ -0,1 +1,26 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*

@@ -10,21 +35,66 @@ Language: HTTP

function http(hljs) {
var VERSION = 'HTTP/[0-9\\.]+';
const VERSION = 'HTTP/(2|1\\.[01])';
const HEADER_NAME = /[A-Za-z][A-Za-z0-9-]*/;
const HEADERS_AND_BODY = [
{
className: 'attribute',
begin: concat('^', HEADER_NAME, '(?=\\:\\s)'),
starts: {
contains: [
{
className: "punctuation",
begin: /: /,
relevance: 0,
starts: {
end: '$',
relevance: 0
}
}
]
}
},
{
begin: '\\n\\n',
starts: { subLanguage: [], endsWithParent: true }
}
];
return {
name: 'HTTP',
aliases: ['https'],
illegal: '\\S',
illegal: /\S/,
contains: [
// response
{
begin: '^' + VERSION, end: '$',
contains: [{className: 'number', begin: '\\b\\d{3}\\b'}]
begin: '^(?=' + VERSION + " \\d{3})",
end: /$/,
contains: [
{
className: "meta",
begin: VERSION
},
{
className: 'number', begin: '\\b\\d{3}\\b'
}
],
starts: {
end: /\b\B/,
illegal: /\S/,
contains: HEADERS_AND_BODY
}
},
// request
{
begin: '^[A-Z]+ (.*?) ' + VERSION + '$', returnBegin: true, end: '$',
begin: '(?=^[A-Z]+ (.*?) ' + VERSION + '$)',
end: /$/,
contains: [
{
className: 'string',
begin: ' ', end: ' ',
excludeBegin: true, excludeEnd: true
begin: ' ',
end: ' ',
excludeBegin: true,
excludeEnd: true
},
{
className: "meta",
begin: VERSION

@@ -36,13 +106,8 @@ },

}
]
},
{
className: 'attribute',
begin: '^\\w', end: ': ', excludeEnd: true,
illegal: '\\n|\\s|=',
starts: {end: '$', relevance: 0}
},
{
begin: '\\n\\n',
starts: {subLanguage: [], endsWithParent: true}
],
starts: {
end: /\b\B/,
illegal: /\S/,
contains: HEADERS_AND_BODY
}
}

@@ -49,0 +114,0 @@ ]

@@ -306,3 +306,3 @@ const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';

const JSDOC_COMMENT = hljs.COMMENT(
'/\\*\\*',
/\/\*\*(?!\/)/,
'\\*/',

@@ -309,0 +309,0 @@ {

@@ -72,3 +72,4 @@ /*

'mk',
'mak'
'mak',
'make',
],

@@ -75,0 +76,0 @@ keywords: {

@@ -185,3 +185,3 @@ /**

/\//,
REGEX_MODIFIERS,
REGEX_MODIFIERS
),

@@ -188,0 +188,0 @@ relevance: 10

@@ -30,2 +30,3 @@ /*

contains: [
{ begin: '\\\\\\\\'},
{ begin: '\\\\\\n' }

@@ -32,0 +33,0 @@ ]

@@ -18,2 +18,10 @@ /**

/**
* @param {RegExp | string } re
* @returns {string}
*/
function lookahead(re) {
return concat('(?=', re, ')');
}
/**
* @param {...(RegExp | string) } args

@@ -33,5 +41,6 @@ * @returns {string}

Website: https://www.r-project.org
Category: scientific
Category: common,scientific
*/
/** @type LanguageFn */
function r(hljs) {

@@ -83,3 +92,26 @@ // Identifiers in R cannot start with `_`, but they can start with `.` if it

},
compilerExtensions: [
// allow beforeMatch to act as a "qualifier" for the match
// the full match begin must be [beforeMatch][begin]
(mode, parent) => {
if (!mode.beforeMatch) return;
// starts conflicts with endsParent which we need to make sure the child
// rule is not matched multiple times
if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
const originalMode = Object.assign({}, mode);
Object.keys(mode).forEach((key) => { delete mode[key]; });
mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));
mode.starts = {
relevance: 0,
contains: [
Object.assign(originalMode, { endsParent: true })
]
};
mode.relevance = 0;
delete originalMode.beforeMatch;
}
],
contains: [

@@ -162,2 +194,4 @@ // Roxygen comments

className: 'number',
relevance: 0,
beforeMatch: /([^a-zA-Z0-9._])/, // not part of an identifier
variants: [

@@ -168,32 +202,14 @@ // TODO: replace with negative look-behind when available

// { begin: /(?<![a-zA-Z0-9._])(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[Li]?/ }
// The below rules all eat an extra character in front (for the
// look-behind check) and then exclude it from the match, but I think
// in many cases this will work out just fine.
{
// Special case: only hexadecimal binary powers can contain fractions.
begin: /([^a-zA-Z0-9._])(?=0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?)/,
end: /0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,
excludeBegin: true
match: /0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,
},
{
begin: /([^a-zA-Z0-9._])(?=0[xX][0-9a-fA-F]+([pP][+-]?\d+)?[Li]?)/,
end: /0[xX][0-9a-fA-F]+([pP][+-]?\d+)?[Li]?/ ,
excludeBegin: true
match: /0[xX][0-9a-fA-F]+([pP][+-]?\d+)?[Li]?/
},
{
begin: /([^a-zA-Z0-9._])(?=(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[Li]?)/,
end: /(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[Li]?/,
excludeBegin: true
match: /(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[Li]?/,
}
],
// "on:begin": (match, response) => {
// if (match.index > 0) {
// let priorChar = match.input[match.index - 1];
// if (priorChar.match(/[a-zA-Z0-9._]/)) response.ignoreMatch();
// }
// },
relevance: 0
},
{

@@ -200,0 +216,0 @@ // infix operator

@@ -13,6 +13,6 @@ /*

function scheme(hljs) {
var SCHEME_IDENT_RE = '[^\\(\\)\\[\\]\\{\\}",\'`;#|\\\\\\s]+';
var SCHEME_SIMPLE_NUMBER_RE = '(-|\\+)?\\d+([./]\\d+)?';
var SCHEME_COMPLEX_NUMBER_RE = SCHEME_SIMPLE_NUMBER_RE + '[+\\-]' + SCHEME_SIMPLE_NUMBER_RE + 'i';
var KEYWORDS = {
const SCHEME_IDENT_RE = '[^\\(\\)\\[\\]\\{\\}",\'`;#|\\\\\\s]+';
const SCHEME_SIMPLE_NUMBER_RE = '(-|\\+)?\\d+([./]\\d+)?';
const SCHEME_COMPLEX_NUMBER_RE = SCHEME_SIMPLE_NUMBER_RE + '[+\\-]' + SCHEME_SIMPLE_NUMBER_RE + 'i';
const KEYWORDS = {
$pattern: SCHEME_IDENT_RE,

@@ -55,3 +55,3 @@ 'builtin-name':

var LITERAL = {
const LITERAL = {
className: 'literal',

@@ -61,16 +61,28 @@ begin: '(#t|#f|#\\\\' + SCHEME_IDENT_RE + '|#\\\\.)'

var NUMBER = {
const NUMBER = {
className: 'number',
variants: [
{ begin: SCHEME_SIMPLE_NUMBER_RE, relevance: 0 },
{ begin: SCHEME_COMPLEX_NUMBER_RE, relevance: 0 },
{ begin: '#b[0-1]+(/[0-1]+)?' },
{ begin: '#o[0-7]+(/[0-7]+)?' },
{ begin: '#x[0-9a-f]+(/[0-9a-f]+)?' }
{
begin: SCHEME_SIMPLE_NUMBER_RE,
relevance: 0
},
{
begin: SCHEME_COMPLEX_NUMBER_RE,
relevance: 0
},
{
begin: '#b[0-1]+(/[0-1]+)?'
},
{
begin: '#o[0-7]+(/[0-7]+)?'
},
{
begin: '#x[0-9a-f]+(/[0-9a-f]+)?'
}
]
};
var STRING = hljs.QUOTE_STRING_MODE;
const STRING = hljs.QUOTE_STRING_MODE;
var COMMENT_MODES = [
const COMMENT_MODES = [
hljs.COMMENT(

@@ -86,3 +98,3 @@ ';',

var IDENT = {
const IDENT = {
begin: SCHEME_IDENT_RE,

@@ -92,3 +104,3 @@ relevance: 0

var QUOTED_IDENT = {
const QUOTED_IDENT = {
className: 'symbol',

@@ -98,3 +110,3 @@ begin: '\'' + SCHEME_IDENT_RE

var BODY = {
const BODY = {
endsWithParent: true,

@@ -104,11 +116,23 @@ relevance: 0

var QUOTED_LIST = {
const QUOTED_LIST = {
variants: [
{ begin: /'/ },
{ begin: '`' }
{
begin: /'/
},
{
begin: '`'
}
],
contains: [
{
begin: '\\(', end: '\\)',
contains: ['self', LITERAL, STRING, NUMBER, IDENT, QUOTED_IDENT]
begin: '\\(',
end: '\\)',
contains: [
'self',
LITERAL,
STRING,
NUMBER,
IDENT,
QUOTED_IDENT
]
}

@@ -118,3 +142,3 @@ ]

var NAME = {
const NAME = {
className: 'name',

@@ -126,9 +150,21 @@ relevance: 0,

var LAMBDA = {
begin: /lambda/, endsWithParent: true, returnBegin: true,
const LAMBDA = {
begin: /lambda/,
endsWithParent: true,
returnBegin: true,
contains: [
NAME,
{
begin: /\(/, end: /\)/, endsParent: true,
contains: [IDENT],
endsParent: true,
variants: [
{
begin: /\(/,
end: /\)/
},
{
begin: /\[/,
end: /\]/
}
],
contains: [ IDENT ]
}

@@ -138,11 +174,29 @@ ]

var LIST = {
const LIST = {
variants: [
{ begin: '\\(', end: '\\)' },
{ begin: '\\[', end: '\\]' }
{
begin: '\\(',
end: '\\)'
},
{
begin: '\\[',
end: '\\]'
}
],
contains: [LAMBDA, NAME, BODY]
contains: [
LAMBDA,
NAME,
BODY
]
};
BODY.contains = [LITERAL, NUMBER, STRING, IDENT, QUOTED_IDENT, QUOTED_LIST, LIST].concat(COMMENT_MODES);
BODY.contains = [
LITERAL,
NUMBER,
STRING,
IDENT,
QUOTED_IDENT,
QUOTED_LIST,
LIST
].concat(COMMENT_MODES);

@@ -152,3 +206,10 @@ return {

illegal: /\S/,
contains: [hljs.SHEBANG(), NUMBER, STRING, QUOTED_IDENT, QUOTED_LIST, LIST].concat(COMMENT_MODES)
contains: [
hljs.SHEBANG(),
NUMBER,
STRING,
QUOTED_IDENT,
QUOTED_LIST,
LIST
].concat(COMMENT_MODES)
};

@@ -155,0 +216,0 @@ }

@@ -0,166 +1,695 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] } args
* @returns {string}
*/
function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*
Language: SQL
Contributors: Nikolay Lisienko <info@neor.ru>, Heiko August <post@auge8472.de>, Travis Odom <travis.a.odom@gmail.com>, Vadimtro <vadimtro@yahoo.com>, Benjamin Auder <benjamin.auder@gmail.com>
Website: https://en.wikipedia.org/wiki/SQL
Category: common
Category: common, database
*/
function sql(hljs) {
var COMMENT_MODE = hljs.COMMENT('--', '$');
const COMMENT_MODE = hljs.COMMENT('--', '$');
const STRING = {
className: 'string',
variants: [
{
begin: /'/,
end: /'/,
contains: [
{begin: /''/ }
]
}
]
};
const QUOTED_IDENTIFIER = {
begin: /"/,
end: /"/,
contains: [ { begin: /""/ } ]
};
const LITERALS = [
"true",
"false",
// Not sure it's correct to call NULL literal, and clauses like IS [NOT] NULL look strange that way.
// "null",
"unknown"
];
const MULTI_WORD_TYPES = [
"double precision",
"large object",
"with timezone",
"without timezone"
];
const TYPES = [
'bigint',
'binary',
'blob',
'boolean',
'char',
'character',
'clob',
'date',
'dec',
'decfloat',
'decimal',
'float',
'int',
'integer',
'interval',
'nchar',
'nclob',
'national',
'numeric',
'real',
'row',
'smallint',
'time',
'timestamp',
'varchar',
'varying', // modifier (character varying)
'varbinary'
];
const NON_RESERVED_WORDS = [
"add",
"asc",
"collation",
"desc",
"final",
"first",
"last",
"view"
];
// https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#reserved-word
const RESERVED_WORDS = [
"abs",
"acos",
"all",
"allocate",
"alter",
"and",
"any",
"are",
"array",
"array_agg",
"array_max_cardinality",
"as",
"asensitive",
"asin",
"asymmetric",
"at",
"atan",
"atomic",
"authorization",
"avg",
"begin",
"begin_frame",
"begin_partition",
"between",
"bigint",
"binary",
"blob",
"boolean",
"both",
"by",
"call",
"called",
"cardinality",
"cascaded",
"case",
"cast",
"ceil",
"ceiling",
"char",
"char_length",
"character",
"character_length",
"check",
"classifier",
"clob",
"close",
"coalesce",
"collate",
"collect",
"column",
"commit",
"condition",
"connect",
"constraint",
"contains",
"convert",
"copy",
"corr",
"corresponding",
"cos",
"cosh",
"count",
"covar_pop",
"covar_samp",
"create",
"cross",
"cube",
"cume_dist",
"current",
"current_catalog",
"current_date",
"current_default_transform_group",
"current_path",
"current_role",
"current_row",
"current_schema",
"current_time",
"current_timestamp",
"current_path",
"current_role",
"current_transform_group_for_type",
"current_user",
"cursor",
"cycle",
"date",
"day",
"deallocate",
"dec",
"decimal",
"decfloat",
"declare",
"default",
"define",
"delete",
"dense_rank",
"deref",
"describe",
"deterministic",
"disconnect",
"distinct",
"double",
"drop",
"dynamic",
"each",
"element",
"else",
"empty",
"end",
"end_frame",
"end_partition",
"end-exec",
"equals",
"escape",
"every",
"except",
"exec",
"execute",
"exists",
"exp",
"external",
"extract",
"false",
"fetch",
"filter",
"first_value",
"float",
"floor",
"for",
"foreign",
"frame_row",
"free",
"from",
"full",
"function",
"fusion",
"get",
"global",
"grant",
"group",
"grouping",
"groups",
"having",
"hold",
"hour",
"identity",
"in",
"indicator",
"initial",
"inner",
"inout",
"insensitive",
"insert",
"int",
"integer",
"intersect",
"intersection",
"interval",
"into",
"is",
"join",
"json_array",
"json_arrayagg",
"json_exists",
"json_object",
"json_objectagg",
"json_query",
"json_table",
"json_table_primitive",
"json_value",
"lag",
"language",
"large",
"last_value",
"lateral",
"lead",
"leading",
"left",
"like",
"like_regex",
"listagg",
"ln",
"local",
"localtime",
"localtimestamp",
"log",
"log10",
"lower",
"match",
"match_number",
"match_recognize",
"matches",
"max",
"member",
"merge",
"method",
"min",
"minute",
"mod",
"modifies",
"module",
"month",
"multiset",
"national",
"natural",
"nchar",
"nclob",
"new",
"no",
"none",
"normalize",
"not",
"nth_value",
"ntile",
"null",
"nullif",
"numeric",
"octet_length",
"occurrences_regex",
"of",
"offset",
"old",
"omit",
"on",
"one",
"only",
"open",
"or",
"order",
"out",
"outer",
"over",
"overlaps",
"overlay",
"parameter",
"partition",
"pattern",
"per",
"percent",
"percent_rank",
"percentile_cont",
"percentile_disc",
"period",
"portion",
"position",
"position_regex",
"power",
"precedes",
"precision",
"prepare",
"primary",
"procedure",
"ptf",
"range",
"rank",
"reads",
"real",
"recursive",
"ref",
"references",
"referencing",
"regr_avgx",
"regr_avgy",
"regr_count",
"regr_intercept",
"regr_r2",
"regr_slope",
"regr_sxx",
"regr_sxy",
"regr_syy",
"release",
"result",
"return",
"returns",
"revoke",
"right",
"rollback",
"rollup",
"row",
"row_number",
"rows",
"running",
"savepoint",
"scope",
"scroll",
"search",
"second",
"seek",
"select",
"sensitive",
"session_user",
"set",
"show",
"similar",
"sin",
"sinh",
"skip",
"smallint",
"some",
"specific",
"specifictype",
"sql",
"sqlexception",
"sqlstate",
"sqlwarning",
"sqrt",
"start",
"static",
"stddev_pop",
"stddev_samp",
"submultiset",
"subset",
"substring",
"substring_regex",
"succeeds",
"sum",
"symmetric",
"system",
"system_time",
"system_user",
"table",
"tablesample",
"tan",
"tanh",
"then",
"time",
"timestamp",
"timezone_hour",
"timezone_minute",
"to",
"trailing",
"translate",
"translate_regex",
"translation",
"treat",
"trigger",
"trim",
"trim_array",
"true",
"truncate",
"uescape",
"union",
"unique",
"unknown",
"unnest",
"update ",
"upper",
"user",
"using",
"value",
"values",
"value_of",
"var_pop",
"var_samp",
"varbinary",
"varchar",
"varying",
"versioning",
"when",
"whenever",
"where",
"width_bucket",
"window",
"with",
"within",
"without",
"year",
];
// these are reserved words we have identified to be functions
// and should only be highlighted in a dispatch-like context
// ie, array_agg(...), etc.
const RESERVED_FUNCTIONS = [
"abs",
"acos",
"array_agg",
"asin",
"atan",
"avg",
"cast",
"ceil",
"ceiling",
"coalesce",
"corr",
"cos",
"cosh",
"count",
"covar_pop",
"covar_samp",
"cume_dist",
"dense_rank",
"deref",
"element",
"exp",
"extract",
"first_value",
"floor",
"json_array",
"json_arrayagg",
"json_exists",
"json_object",
"json_objectagg",
"json_query",
"json_table",
"json_table_primitive",
"json_value",
"lag",
"last_value",
"lead",
"listagg",
"ln",
"log",
"log10",
"lower",
"max",
"min",
"mod",
"nth_value",
"ntile",
"nullif",
"percent_rank",
"percentile_cont",
"percentile_disc",
"position",
"position_regex",
"power",
"rank",
"regr_avgx",
"regr_avgy",
"regr_count",
"regr_intercept",
"regr_r2",
"regr_slope",
"regr_sxx",
"regr_sxy",
"regr_syy",
"row_number",
"sin",
"sinh",
"sqrt",
"stddev_pop",
"stddev_samp",
"substring",
"substring_regex",
"sum",
"tan",
"tanh",
"translate",
"translate_regex",
"treat",
"trim",
"trim_array",
"unnest",
"upper",
"value_of",
"var_pop",
"var_samp",
"width_bucket",
];
// these functions can
const POSSIBLE_WITHOUT_PARENS = [
"current_catalog",
"current_date",
"current_default_transform_group",
"current_path",
"current_role",
"current_schema",
"current_transform_group_for_type",
"current_user",
"session_user",
"system_time",
"system_user",
"current_time",
"localtime",
"current_timestamp",
"localtimestamp"
];
// those exist to boost relevance making these very
// "SQL like" keyword combos worth +1 extra relevance
const COMBOS = [
"create table",
"insert into",
"primary key",
"foreign key",
"not null",
"alter table",
"add constraint",
"grouping sets",
"on overflow",
"character set",
"respect nulls",
"ignore nulls",
"nulls first",
"nulls last",
"depth first",
"breadth first"
];
const FUNCTIONS = RESERVED_FUNCTIONS;
const KEYWORDS = [...RESERVED_WORDS, ...NON_RESERVED_WORDS].filter((keyword) => {
return !RESERVED_FUNCTIONS.includes(keyword);
});
const VARIABLE = {
className: "variable",
begin: /@[a-z0-9]+/,
};
const OPERATOR = {
className: "operator",
begin: /[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,
relevance: 0,
};
const FUNCTION_CALL = {
begin: concat(/\b/, either(...FUNCTIONS), /\s*\(/),
keywords: {
built_in: FUNCTIONS.join(" ")
}
};
// keywords with less than 3 letters are reduced in relevancy
function reduceRelevancy(list, {exceptions, when} = {}) {
const qualifyFn = when;
exceptions = exceptions || [];
return list.map((item) => {
if (item.match(/\|\d+$/) || exceptions.includes(item)) {
return item;
} else if (qualifyFn(item)) {
return `${item}|0`;
} else {
return item;
}
});
}
return {
name: 'SQL',
case_insensitive: true,
illegal: /[<>{}*]/,
// does not include {} or HTML tags `</`
illegal: /[{}]|<\//,
keywords: {
$pattern: /\b[\w\.]+/,
keyword:
reduceRelevancy(KEYWORDS, { when: (x) => x.length < 3 }).join(" "),
literal: LITERALS.join(" "),
type: TYPES.join(" "),
built_in: POSSIBLE_WITHOUT_PARENS.join(" ")
},
contains: [
{
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 release ' +
'unlock purge reset change stop analyze cache flush optimize repair kill ' +
'install uninstall checksum restore check backup revoke comment values with',
end: /;/, endsWithParent: true,
begin: either(...COMBOS),
keywords: {
$pattern: /[\w\.]+/,
keyword:
'as abort abs absolute acc acce accep accept access accessed accessible account acos action activate add ' +
'addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias ' +
'all allocate allow alter always analyze ancillary and anti any anydata anydataset anyschema anytype apply ' +
'archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan ' +
'atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid ' +
'authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile ' +
'before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float ' +
'binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound ' +
'bucket buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel ' +
'capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base ' +
'char_length character_length characters characterset charindex charset charsetform charsetid check ' +
'checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close ' +
'cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation ' +
'collect colu colum column column_value columns columns_updated comment commit compact compatibility ' +
'compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn ' +
'connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection ' +
'consider consistent constant constraint constraints constructor container content contents context ' +
'contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost ' +
'count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation ' +
'critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user ' +
'cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add ' +
'date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts ' +
'day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate ' +
'declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults ' +
'deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank ' +
'depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor ' +
'deterministic diagnostics difference dimension direct_load directory disable disable_all ' +
'disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div ' +
'do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable ' +
'editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt ' +
'end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors ' +
'escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding ' +
'execu execut execute exempt exists exit exp expire explain explode export export_set extended extent external ' +
'external_1 external_2 externally extract failed failed_login_attempts failover failure far fast ' +
'feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final ' +
'finish first first_value fixed flash_cache flashback floor flush following follows for forall force foreign ' +
'form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ' +
'ftp full function general generated get get_format get_lock getdate getutcdate global global_name ' +
'globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups ' +
'gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex ' +
'hierarchy high high_priority hosts hour hours http id ident_current ident_incr ident_seed identified ' +
'identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment ' +
'index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile ' +
'initial initialized initially initrans inmemory inner innodb input insert install instance instantiable ' +
'instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat ' +
'is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists ' +
'keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lateral lax lcase ' +
'lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit ' +
'lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate ' +
'locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call ' +
'logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime ' +
'managed management manual map mapping mask master master_pos_wait match matched materialized max ' +
'maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans ' +
'md5 measures median medium member memcompress memory merge microsecond mid migration min minextents ' +
'minimum mining minus minute minutes minvalue missing mod mode model modification modify module monitoring month ' +
'months mount move movement multiset mutex name name_const names nan national native natural nav nchar ' +
'nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile ' +
'nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile ' +
'nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder ' +
'nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck ' +
'noswitch not nothing notice notnull notrim novalidate now nowait nth_value nullif nulls num numb numbe ' +
'nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ' +
'ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old ' +
'on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date ' +
'oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary ' +
'out outer outfile outline output over overflow overriding package pad parallel parallel_enable ' +
'parameters parent parse partial partition partitions pascal passing password password_grace_time ' +
'password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex ' +
'pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc ' +
'performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin ' +
'policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction ' +
'prediction_cost prediction_details prediction_probability prediction_set prepare present preserve ' +
'prior priority private private_sga privileges procedural procedure procedure_analyze processlist ' +
'profiles project prompt protection public publishingservername purge quarter query quick quiesce quota ' +
'quotename radians raise rand range rank raw read reads readsize rebuild record records ' +
'recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh ' +
'regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy ' +
'reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename ' +
'repair repeat replace replicate replication required reset resetlogs resize resource respect restore ' +
'restricted result result_cache resumable resume retention return returning returns reuse reverse revoke ' +
'right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows ' +
'rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll ' +
'sdo_georaster sdo_topo_geometry search sec_to_time second seconds section securefile security seed segment select ' +
'self semi sequence sequential serializable server servererror session session_user sessions_per_user set ' +
'sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor ' +
'si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin ' +
'size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex ' +
'source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows ' +
'sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone ' +
'standby start starting startup statement static statistics stats_binomial_test stats_crosstab ' +
'stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep ' +
'stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev ' +
'stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate ' +
'subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum ' +
'suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate ' +
'sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tablesample tan tdo ' +
'template temporary terminated tertiary_weights test than then thread through tier ties time time_format ' +
'time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr ' +
'timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking ' +
'transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate ' +
'try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress ' +
'under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unnest unpivot ' +
'unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert ' +
'url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date ' +
'utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var ' +
'var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray ' +
'verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear ' +
'wellformed when whene whenev wheneve whenever where while whitespace window with within without work wrapped ' +
'xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces ' +
'xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek',
literal:
'true false null unknown',
built_in:
'array bigint binary bit blob bool boolean char character date dec decimal float int int8 integer interval number ' +
'numeric real record serial serial8 smallint text time timestamp tinyint varchar varchar2 varying void'
keyword: KEYWORDS.concat(COMBOS).join(" "),
literal: LITERALS.join(" "),
type: TYPES.join(" ")
},
contains: [
{
className: 'string',
begin: '\'', end: '\'',
contains: [{begin: '\'\''}]
},
{
className: 'string',
begin: '"', end: '"',
contains: [{begin: '""'}]
},
{
className: 'string',
begin: '`', end: '`'
},
hljs.C_NUMBER_MODE,
hljs.C_BLOCK_COMMENT_MODE,
COMMENT_MODE,
hljs.HASH_COMMENT_MODE
]
},
{
className: "type",
begin: either(...MULTI_WORD_TYPES)
},
FUNCTION_CALL,
VARIABLE,
STRING,
QUOTED_IDENTIFIER,
hljs.C_NUMBER_MODE,
hljs.C_BLOCK_COMMENT_MODE,
COMMENT_MODE,
hljs.HASH_COMMENT_MODE
OPERATOR
]

@@ -167,0 +696,0 @@ };

@@ -0,6 +1,357 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {RegExp | string } re
* @returns {string}
*/
function lookahead(re) {
return concat('(?=', re, ')');
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] } args
* @returns {string}
*/
function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
return joined;
}
const keywordWrapper = keyword => concat(
/\b/,
keyword,
/\w$/.test(keyword) ? /\b/ : /\B/
);
// Keywords that require a leading dot.
const dotKeywords = [
'Protocol', // contextual
'Type' // contextual
].map(keywordWrapper);
// Keywords that may have a leading dot.
const optionalDotKeywords = [
'init',
'self'
].map(keywordWrapper);
// should register as keyword, not type
const keywordTypes = [
'Any',
'Self'
];
// Regular keywords and literals.
const keywords = [
// strings below will be fed into the regular `keywords` engine while regex
// will result in additional modes being created to scan for those keywords to
// avoid conflicts with other rules
'associatedtype',
/as\?/, // operator
/as!/, // operator
'as', // operator
'break',
'case',
'catch',
'class',
'continue',
'convenience', // contextual
'default',
'defer',
'deinit',
'didSet', // contextual
'do',
'dynamic', // contextual
'else',
'enum',
'extension',
'fallthrough',
'fileprivate(set)',
'fileprivate',
'final', // contextual
'for',
'func',
'get', // contextual
'guard',
'if',
'import',
'indirect', // contextual
'infix', // contextual
/init\?/,
/init!/,
'inout',
'internal(set)',
'internal',
'in',
'is', // operator
'lazy', // contextual
'let',
'mutating', // contextual
'nonmutating', // contextual
'open(set)', // contextual
'open', // contextual
'operator',
'optional', // contextual
'override', // contextual
'postfix', // contextual
'precedencegroup',
'prefix', // contextual
'private(set)',
'private',
'protocol',
'public(set)',
'public',
'repeat',
'required', // contextual
'rethrows',
'return',
'set', // contextual
'some', // contextual
'static',
'struct',
'subscript',
'super',
'switch',
'throws',
'throw',
/try\?/, // operator
/try!/, // operator
'try', // operator
'typealias',
'unowned(safe)', // contextual
'unowned(unsafe)', // contextual
'unowned', // contextual
'var',
'weak', // contextual
'where',
'while',
'willSet' // contextual
];
// NOTE: Contextual keywords are reserved only in specific contexts.
// Ideally, these should be matched using modes to avoid false positives.
// TODO: Create a PRECEDENCE_GROUP mode to match the remaining contextual keywords:
// assignment associativity higherThan left lowerThan none right
// These aren't included in the list because they result in mostly false positives.
// Literals.
const literals = [
'false',
'nil',
'true'
];
// Keywords that start with a number sign (#).
// #available is handled separately.
const numberSignKeywords = [
'#colorLiteral',
'#column',
'#dsohandle',
'#else',
'#elseif',
'#endif',
'#error',
'#file',
'#fileID',
'#fileLiteral',
'#filePath',
'#function',
'#if',
'#imageLiteral',
'#keyPath',
'#line',
'#selector',
'#sourceLocation',
'#warn_unqualified_access',
'#warning'
];
// Global functions in the Standard Library.
const builtIns = [
'abs',
'all',
'any',
'assert',
'assertionFailure',
'debugPrint',
'dump',
'fatalError',
'getVaList',
'isKnownUniquelyReferenced',
'max',
'min',
'numericCast',
'pointwiseMax',
'pointwiseMin',
'precondition',
'preconditionFailure',
'print',
'readLine',
'repeatElement',
'sequence',
'stride',
'swap',
'swift_unboxFromSwiftValueWithType',
'transcode',
'type',
'unsafeBitCast',
'unsafeDowncast',
'withExtendedLifetime',
'withUnsafeMutablePointer',
'withUnsafePointer',
'withVaList',
'withoutActuallyEscaping',
'zip'
];
// Valid first characters for operators.
const operatorHead = either(
/[/=\-+!*%<>&|^~?]/,
/[\u00A1-\u00A7]/,
/[\u00A9\u00AB]/,
/[\u00AC\u00AE]/,
/[\u00B0\u00B1]/,
/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,
/[\u2016-\u2017]/,
/[\u2020-\u2027]/,
/[\u2030-\u203E]/,
/[\u2041-\u2053]/,
/[\u2055-\u205E]/,
/[\u2190-\u23FF]/,
/[\u2500-\u2775]/,
/[\u2794-\u2BFF]/,
/[\u2E00-\u2E7F]/,
/[\u3001-\u3003]/,
/[\u3008-\u3020]/,
/[\u3030]/
);
// Valid characters for operators.
const operatorCharacter = either(
operatorHead,
/[\u0300-\u036F]/,
/[\u1DC0-\u1DFF]/,
/[\u20D0-\u20FF]/,
/[\uFE00-\uFE0F]/,
/[\uFE20-\uFE2F]/
// TODO: The following characters are also allowed, but the regex isn't supported yet.
// /[\u{E0100}-\u{E01EF}]/u
);
// Valid operator.
const operator = concat(operatorHead, operatorCharacter, '*');
// Valid first characters for identifiers.
const identifierHead = either(
/[a-zA-Z_]/,
/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,
/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,
/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,
/[\u1E00-\u1FFF]/,
/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,
/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,
/[\u2C00-\u2DFF\u2E80-\u2FFF]/,
/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,
/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,
/[\uFE47-\uFFFD]/
// The following characters are also allowed, but the regexes aren't supported yet.
// /[\u{10000}-\u{1FFFD}\u{20000-\u{2FFFD}\u{30000}-\u{3FFFD}\u{40000}-\u{4FFFD}]/u,
// /[\u{50000}-\u{5FFFD}\u{60000-\u{6FFFD}\u{70000}-\u{7FFFD}\u{80000}-\u{8FFFD}]/u,
// /[\u{90000}-\u{9FFFD}\u{A0000-\u{AFFFD}\u{B0000}-\u{BFFFD}\u{C0000}-\u{CFFFD}]/u,
// /[\u{D0000}-\u{DFFFD}\u{E0000-\u{EFFFD}]/u
);
// Valid characters for identifiers.
const identifierCharacter = either(
identifierHead,
/\d/,
/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/
);
// Valid identifier.
const identifier = concat(identifierHead, identifierCharacter, '*');
// Valid type identifier.
const typeIdentifier = concat(/[A-Z]/, identifierCharacter, '*');
// Built-in attributes, which are highlighted as keywords.
// @available is handled separately.
const keywordAttributes = [
'autoclosure',
concat(/convention\(/, either('swift', 'block', 'c'), /\)/),
'discardableResult',
'dynamicCallable',
'dynamicMemberLookup',
'escaping',
'frozen',
'GKInspectable',
'IBAction',
'IBDesignable',
'IBInspectable',
'IBOutlet',
'IBSegueAction',
'inlinable',
'main',
'nonobjc',
'NSApplicationMain',
'NSCopying',
'NSManaged',
concat(/objc\(/, identifier, /\)/),
'objc',
'objcMembers',
'propertyWrapper',
'requires_stored_property_inits',
'testable',
'UIApplicationMain',
'unknown',
'usableFromInline'
];
// Contextual keywords used in @available and #available.
const availabilityKeywords = [
'iOS',
'iOSApplicationExtension',
'macOS',
'macOSApplicationExtension',
'macCatalyst',
'macCatalystApplicationExtension',
'watchOS',
'watchOSApplicationExtension',
'tvOS',
'tvOSApplicationExtension',
'swift'
];
/*
Language: Swift
Description: Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.
Author: Chris Eidhof <chris@eidhof.nl>
Contributors: Nate Cook <natecook@gmail.com>, Alexander Lichter <manniL@gmx.net>
Author: Steven Van Impe <steven.vanimpe@icloud.com>
Contributors: Chris Eidhof <chris@eidhof.nl>, Nate Cook <natecook@gmail.com>, Alexander Lichter <manniL@gmx.net>, Richard Gibson <gibson042@github>
Website: https://swift.org

@@ -10,106 +361,308 @@ Category: common, system

/** @type LanguageFn */
function swift(hljs) {
var SWIFT_KEYWORDS = {
// override the pattern since the default of of /\w+/ is not sufficient to
// capture the keywords that start with the character "#"
$pattern: /[\w#]+/,
keyword: '#available #colorLiteral #column #else #elseif #endif #file ' +
'#fileLiteral #function #if #imageLiteral #line #selector #sourceLocation ' +
'_ __COLUMN__ __FILE__ __FUNCTION__ __LINE__ Any as as! as? associatedtype ' +
'associativity break case catch class continue convenience default defer deinit didSet do ' +
'dynamic dynamicType else enum extension fallthrough false fileprivate final for func ' +
'get guard if import in indirect infix init inout internal is lazy left let ' +
'mutating nil none nonmutating open operator optional override postfix precedence ' +
'prefix private protocol Protocol public repeat required rethrows return ' +
'right self Self set some static struct subscript super switch throw throws true ' +
'try try! try? Type typealias unowned var weak where while willSet',
literal: 'true false nil',
built_in: 'abs advance alignof alignofValue anyGenerator assert assertionFailure ' +
'bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC ' +
'bridgeToObjectiveCUnconditional c compactMap contains count countElements countLeadingZeros ' +
'debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords ' +
'enumerate equal fatalError filter find getBridgedObjectiveCType getVaList ' +
'indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC ' +
'isUniquelyReferenced isUniquelyReferencedNonObjC join lazy lexicographicalCompare ' +
'map max maxElement min minElement numericCast overlaps partition posix ' +
'precondition preconditionFailure print println quickSort readLine reduce reflect ' +
'reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split ' +
'startsWith stride strideof strideofValue swap toString transcode ' +
'underestimateCount unsafeAddressOf unsafeBitCast unsafeDowncast unsafeUnwrap ' +
'unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer ' +
'withUnsafePointerToObject withUnsafeMutablePointer withUnsafeMutablePointers ' +
'withUnsafePointer withUnsafePointers withVaList zip'
};
var TYPE = {
className: 'type',
begin: '\\b[A-Z][\\w\u00C0-\u02B8\']*',
relevance: 0
};
// slightly more special to swift
var OPTIONAL_USING_TYPE = {
className: 'type',
begin: '\\b[A-Z][\\w\u00C0-\u02B8\']*[!?]'
};
var BLOCK_COMMENT = hljs.COMMENT(
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID411
const BLOCK_COMMENT = hljs.COMMENT(
'/\\*',
'\\*/',
{
contains: ['self']
contains: [ 'self' ]
}
);
var SUBST = {
className: 'subst',
begin: /\\\(/, end: '\\)',
keywords: SWIFT_KEYWORDS,
contains: [] // assigned later
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID413
// https://docs.swift.org/swift-book/ReferenceManual/zzSummaryOfTheGrammar.html
const DOT_KEYWORD = {
className: 'keyword',
begin: concat(/\./, lookahead(either(...dotKeywords, ...optionalDotKeywords))),
end: either(...dotKeywords, ...optionalDotKeywords),
excludeBegin: true
};
var STRING = {
className: 'string',
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
const KEYWORD_GUARD = {
// Consume .keyword to prevent highlighting properties and methods as keywords.
begin: concat(/\./, either(...keywords)),
relevance: 0
};
const PLAIN_KEYWORDS = keywords
.filter(kw => typeof kw === 'string')
.concat([ "_|0" ]); // seems common, so 0 relevance
const REGEX_KEYWORDS = keywords
.filter(kw => typeof kw !== 'string') // find regex
.concat(keywordTypes)
.map(keywordWrapper);
const KEYWORD = {
variants: [
{begin: /"""/, end: /"""/},
{begin: /"/, end: /"/},
{
className: 'keyword',
begin: either(...REGEX_KEYWORDS, ...optionalDotKeywords)
}
]
};
// find all the regular keywords
const KEYWORDS = {
$pattern: either(
/\b\w+(\(\w+\))?/, // kw or kw(arg)
/#\w+/ // number keywords
),
keyword: PLAIN_KEYWORDS
.concat(numberSignKeywords)
.join(" "),
literal: literals.join(" ")
};
const KEYWORD_MODES = [
DOT_KEYWORD,
KEYWORD_GUARD,
KEYWORD
];
// https://github.com/apple/swift/tree/main/stdlib/public/core
const BUILT_IN_GUARD = {
// Consume .built_in to prevent highlighting properties and methods.
begin: concat(/\./, either(...builtIns)),
relevance: 0
};
const BUILT_IN = {
className: 'built_in',
begin: concat(/\b/, either(...builtIns), /(?=\()/)
};
const BUILT_INS = [
BUILT_IN_GUARD,
BUILT_IN
];
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID418
const OPERATOR_GUARD = {
// Prevent -> from being highlighting as an operator.
begin: /->/,
relevance: 0
};
const OPERATOR = {
className: 'operator',
relevance: 0,
variants: [
{
begin: operator
},
{
// dot-operator: only operators that start with a dot are allowed to use dots as
// characters (..., ...<, .*, etc). So there rule here is: a dot followed by one or more
// characters that may also include dots.
begin: `\\.(\\.|${operatorCharacter})+`
}
]
};
const OPERATORS = [
OPERATOR_GUARD,
OPERATOR
];
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#grammar_numeric-literal
// TODO: Update for leading `-` after lookbehind is supported everywhere
var decimalDigits = '([0-9]_*)+';
var hexDigits = '([0-9a-fA-F]_*)+';
var NUMBER = {
className: 'number',
relevance: 0,
variants: [
// decimal floating-point-literal (subsumes decimal-literal)
{ begin: `\\b(${decimalDigits})(\\.(${decimalDigits}))?` +
`([eE][+-]?(${decimalDigits}))?\\b` },
const decimalDigits = '([0-9]_*)+';
const hexDigits = '([0-9a-fA-F]_*)+';
const NUMBER = {
className: 'number',
relevance: 0,
variants: [
// decimal floating-point-literal (subsumes decimal-literal)
{
begin: `\\b(${decimalDigits})(\\.(${decimalDigits}))?` + `([eE][+-]?(${decimalDigits}))?\\b`
},
// hexadecimal floating-point-literal (subsumes hexadecimal-literal)
{
begin: `\\b0x(${hexDigits})(\\.(${hexDigits}))?` + `([pP][+-]?(${decimalDigits}))?\\b`
},
// octal-literal
{
begin: /\b0o([0-7]_*)+\b/
},
// binary-literal
{
begin: /\b0b([01]_*)+\b/
}
]
};
// hexadecimal floating-point-literal (subsumes hexadecimal-literal)
{ begin: `\\b0x(${hexDigits})(\\.(${hexDigits}))?` +
`([pP][+-]?(${decimalDigits}))?\\b` },
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#grammar_string-literal
const ESCAPED_CHARACTER = (rawDelimiter = "") => ({
className: 'subst',
variants: [
{
begin: concat(/\\/, rawDelimiter, /[0\\tnr"']/)
},
{
begin: concat(/\\/, rawDelimiter, /u\{[0-9a-fA-F]{1,8}\}/)
}
]
});
const ESCAPED_NEWLINE = (rawDelimiter = "") => ({
className: 'subst',
begin: concat(/\\/, rawDelimiter, /[\t ]*(?:[\r\n]|\r\n)/)
});
const INTERPOLATION = (rawDelimiter = "") => ({
className: 'subst',
label: "interpol",
begin: concat(/\\/, rawDelimiter, /\(/),
end: /\)/
});
const MULTILINE_STRING = (rawDelimiter = "") => ({
begin: concat(rawDelimiter, /"""/),
end: concat(/"""/, rawDelimiter),
contains: [
ESCAPED_CHARACTER(rawDelimiter),
ESCAPED_NEWLINE(rawDelimiter),
INTERPOLATION(rawDelimiter)
]
});
const SINGLE_LINE_STRING = (rawDelimiter = "") => ({
begin: concat(rawDelimiter, /"/),
end: concat(/"/, rawDelimiter),
contains: [
ESCAPED_CHARACTER(rawDelimiter),
INTERPOLATION(rawDelimiter)
]
});
const STRING = {
className: 'string',
variants: [
MULTILINE_STRING(),
MULTILINE_STRING("#"),
MULTILINE_STRING("##"),
MULTILINE_STRING("###"),
SINGLE_LINE_STRING(),
SINGLE_LINE_STRING("#"),
SINGLE_LINE_STRING("##"),
SINGLE_LINE_STRING("###")
]
};
// octal-literal
{ begin: /\b0o([0-7]_*)+\b/ },
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID412
const QUOTED_IDENTIFIER = {
begin: concat(/`/, identifier, /`/)
};
const IMPLICIT_PARAMETER = {
className: 'variable',
begin: /\$\d+/
};
const PROPERTY_WRAPPER_PROJECTION = {
className: 'variable',
begin: `\\$${identifierCharacter}+`
};
const IDENTIFIERS = [
QUOTED_IDENTIFIER,
IMPLICIT_PARAMETER,
PROPERTY_WRAPPER_PROJECTION
];
// binary-literal
{ begin: /\b0b([01]_*)+\b/ },
]
// https://docs.swift.org/swift-book/ReferenceManual/Attributes.html
const AVAILABLE_ATTRIBUTE = {
begin: /(@|#)available\(/,
end: /\)/,
keywords: {
$pattern: /[@#]?\w+/,
keyword: availabilityKeywords
.concat([
"@available",
"#available"
])
.join(' ')
},
contains: [
...OPERATORS,
NUMBER,
STRING
]
};
SUBST.contains = [NUMBER];
const KEYWORD_ATTRIBUTE = {
className: 'keyword',
begin: concat(/@/, either(...keywordAttributes))
};
const USER_DEFINED_ATTRIBUTE = {
className: 'meta',
begin: concat(/@/, identifier)
};
const ATTRIBUTES = [
AVAILABLE_ATTRIBUTE,
KEYWORD_ATTRIBUTE,
USER_DEFINED_ATTRIBUTE
];
// https://docs.swift.org/swift-book/ReferenceManual/Types.html
const TYPE = {
begin: lookahead(/\b[A-Z]/),
relevance: 0,
contains: [
{ // Common Apple frameworks, for relevance boost
className: 'type',
begin: concat(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/, identifierCharacter, '+')
},
{ // Type identifier
className: 'type',
begin: typeIdentifier,
relevance: 0
},
{ // Optional type
begin: /[?!]+/,
relevance: 0
},
{ // Variadic parameter
begin: /\.\.\./,
relevance: 0
},
{ // Protocol composition
begin: concat(/\s+&\s+/, lookahead(typeIdentifier)),
relevance: 0
}
]
};
const GENERIC_ARGUMENTS = {
begin: /</,
end: />/,
keywords: KEYWORDS,
contains: [
...KEYWORD_MODES,
...ATTRIBUTES,
OPERATOR_GUARD,
TYPE
]
};
TYPE.contains.push(GENERIC_ARGUMENTS);
// Add supported submodes to string interpolation.
for (const variant of STRING.variants) {
const interpolation = variant.contains.find(mode => mode.label === "interpol");
// TODO: Interpolation can contain any expression, so there's room for improvement here.
interpolation.keywords = KEYWORDS;
const submodes = [
...KEYWORD_MODES,
...BUILT_INS,
...OPERATORS,
NUMBER,
STRING,
...IDENTIFIERS
];
interpolation.contains = [
...submodes,
{
begin: /\(/,
end: /\)/,
contains: [
'self',
...submodes
]
}
];
}
return {
name: 'Swift',
keywords: SWIFT_KEYWORDS,
keywords: KEYWORDS,
contains: [
STRING,
hljs.C_LINE_COMMENT_MODE,
BLOCK_COMMENT,
OPTIONAL_USING_TYPE,
TYPE,
NUMBER,
{
className: 'function',
beginKeywords: 'func', end: /\{/, excludeEnd: true,
beginKeywords: 'func',
end: /\{/,
excludeEnd: true,
contains: [

@@ -120,14 +673,20 @@ hljs.inherit(hljs.TITLE_MODE, {

{
begin: /</, end: />/
begin: /</,
end: />/
},
{
className: 'params',
begin: /\(/, end: /\)/, endsParent: true,
keywords: SWIFT_KEYWORDS,
begin: /\(/,
end: /\)/,
endsParent: true,
keywords: KEYWORDS,
contains: [
'self',
...KEYWORD_MODES,
NUMBER,
STRING,
hljs.C_BLOCK_COMMENT_MODE,
{begin: ':'} // relevance booster
{ // relevance booster
begin: ':'
}
],

@@ -142,24 +701,29 @@ illegal: /["']/

beginKeywords: 'struct protocol class extension enum',
keywords: SWIFT_KEYWORDS,
end: '\\{',
excludeEnd: true,
keywords: KEYWORDS,
contains: [
hljs.inherit(hljs.TITLE_MODE, {begin: /[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/})
hljs.inherit(hljs.TITLE_MODE, {
begin: /[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/
}),
...KEYWORD_MODES
]
},
{
className: 'meta', // @attributes
begin: '(@discardableResult|@warn_unused_result|@exported|@lazy|@noescape|' +
'@NSCopying|@NSManaged|@objc|@objcMembers|@convention|@required|' +
'@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|' +
'@infix|@prefix|@postfix|@autoclosure|@testable|@available|' +
'@nonobjc|@NSApplicationMain|@UIApplicationMain|@dynamicMemberLookup|' +
'@propertyWrapper|@main)\\b'
beginKeywords: 'import',
end: /$/,
contains: [
hljs.C_LINE_COMMENT_MODE,
BLOCK_COMMENT
],
relevance: 0
},
{
beginKeywords: 'import', end: /$/,
contains: [hljs.C_LINE_COMMENT_MODE, BLOCK_COMMENT],
relevance: 0
}
...KEYWORD_MODES,
...BUILT_INS,
...OPERATORS,
NUMBER,
STRING,
...IDENTIFIERS,
...ATTRIBUTES,
TYPE
]

@@ -166,0 +730,0 @@ };

@@ -306,3 +306,3 @@ const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';

const JSDOC_COMMENT = hljs.COMMENT(
'/\\*\\*',
/\/\*\*(?!\/)/,
'\\*/',

@@ -309,0 +309,0 @@ {

@@ -0,9 +1,169 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] } args
* @returns {string}
*/
function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*
Language: Visual Basic .NET
Description: Visual Basic .NET (VB.NET) is a multi-paradigm, object-oriented programming language, implemented on the .NET Framework.
Author: Poren Chiang <ren.chiang@gmail.com>
Website: https://docs.microsoft.com/en-us/dotnet/visual-basic/getting-started/
Authors: Poren Chiang <ren.chiang@gmail.com>, Jan Pilzer
Website: https://docs.microsoft.com/dotnet/visual-basic/getting-started
Category: common
*/
/** @type LanguageFn */
function vbnet(hljs) {
/**
* Character Literal
* Either a single character ("a"C) or an escaped double quote (""""C).
*/
const CHARACTER = {
className: 'string',
begin: /"(""|[^/n])"C\b/
};
const STRING = {
className: 'string',
begin: /"/,
end: /"/,
illegal: /\n/,
contains: [
{
// double quote escape
begin: /""/
}
]
};
/** Date Literals consist of a date, a time, or both separated by whitespace, surrounded by # */
const MM_DD_YYYY = /\d{1,2}\/\d{1,2}\/\d{4}/;
const YYYY_MM_DD = /\d{4}-\d{1,2}-\d{1,2}/;
const TIME_12H = /(\d|1[012])(:\d+){0,2} *(AM|PM)/;
const TIME_24H = /\d{1,2}(:\d{1,2}){1,2}/;
const DATE = {
className: 'literal',
variants: [
{
// #YYYY-MM-DD# (ISO-Date) or #M/D/YYYY# (US-Date)
begin: concat(/# */, either(YYYY_MM_DD, MM_DD_YYYY), / *#/)
},
{
// #H:mm[:ss]# (24h Time)
begin: concat(/# */, TIME_24H, / *#/)
},
{
// #h[:mm[:ss]] A# (12h Time)
begin: concat(/# */, TIME_12H, / *#/)
},
{
// date plus time
begin: concat(
/# */,
either(YYYY_MM_DD, MM_DD_YYYY),
/ +/,
either(TIME_12H, TIME_24H),
/ *#/
)
}
]
};
const NUMBER = {
className: 'number',
relevance: 0,
variants: [
{
// Float
begin: /\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/
},
{
// Integer (base 10)
begin: /\b\d[\d_]*((U?[SIL])|[%&])?/
},
{
// Integer (base 16)
begin: /&H[\dA-F_]+((U?[SIL])|[%&])?/
},
{
// Integer (base 8)
begin: /&O[0-7_]+((U?[SIL])|[%&])?/
},
{
// Integer (base 2)
begin: /&B[01_]+((U?[SIL])|[%&])?/
}
]
};
const LABEL = {
className: 'label',
begin: /^\w+:/
};
const DOC_COMMENT = hljs.COMMENT(/'''/, /$/, {
contains: [
{
className: 'doctag',
begin: /<\/?/,
end: />/
}
]
});
const COMMENT = hljs.COMMENT(null, /$/, {
variants: [
{
begin: /'/
},
{
// TODO: Use `beforeMatch:` for leading spaces
begin: /([\t ]|^)REM(?=\s)/
}
]
});
const DIRECTIVES = {
className: 'meta',
// TODO: Use `beforeMatch:` for indentation once available
begin: /[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,
end: /$/,
keywords: {
'meta-keyword':
'const disable else elseif enable end externalsource if region then'
},
contains: [ COMMENT ]
};
return {

@@ -13,60 +173,39 @@ name: 'Visual Basic .NET',

case_insensitive: true,
classNameAliases: {
label: 'symbol'
},
keywords: {
keyword:
'addhandler addressof alias and andalso aggregate ansi as async assembly auto await binary by byref byval ' + /* a-b */
'addhandler alias aggregate ansi as async assembly auto binary by byref byval ' + /* a-b */
'call case catch class compare const continue custom declare default delegate dim distinct do ' + /* c-d */
'each equals else elseif end enum erase error event exit explicit finally for friend from function ' + /* e-f */
'get global goto group handles if implements imports in inherits interface into is isfalse isnot istrue iterator ' + /* g-i */
'join key let lib like loop me mid mod module mustinherit mustoverride mybase myclass ' + /* j-m */
'nameof namespace narrowing new next not notinheritable notoverridable ' + /* n */
'of off on operator option optional or order orelse overloads overridable overrides ' + /* o */
'get global goto group handles if implements imports in inherits interface into iterator ' + /* g-i */
'join key let lib loop me mid module mustinherit mustoverride mybase myclass ' + /* j-m */
'namespace narrowing new next notinheritable notoverridable ' + /* n */
'of off on operator option optional order overloads overridable overrides ' + /* o */
'paramarray partial preserve private property protected public ' + /* p */
'raiseevent readonly redim rem removehandler resume return ' + /* r */
'raiseevent readonly redim removehandler resume return ' + /* r */
'select set shadows shared skip static step stop structure strict sub synclock ' + /* s */
'take text then throw to try unicode until using when where while widening with withevents writeonly xor yield', /* t-y */
'take text then throw to try unicode until using when where while widening with withevents writeonly yield' /* t-y */,
built_in:
'boolean byte cbool cbyte cchar cdate cdec cdbl char cint clng cobj csbyte cshort csng cstr ctype ' + /* b-c */
'date decimal directcast double gettype getxmlnamespace iif integer long object ' + /* d-o */
'sbyte short single string trycast typeof uinteger ulong ushort', /* s-u */
literal:
'true false nothing'
// Operators https://docs.microsoft.com/dotnet/visual-basic/language-reference/operators
'addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor ' +
// Type Conversion Functions https://docs.microsoft.com/dotnet/visual-basic/language-reference/functions/type-conversion-functions
'cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort',
type:
// Data types https://docs.microsoft.com/dotnet/visual-basic/language-reference/data-types
'boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort',
literal: 'true false nothing'
},
illegal: '//|\\{|\\}|endif|gosub|variant|wend|^\\$ ', /* reserved deprecated keywords */
illegal:
'//|\\{|\\}|endif|gosub|variant|wend|^\\$ ' /* reserved deprecated keywords */,
contains: [
hljs.inherit(hljs.QUOTE_STRING_MODE, {
contains: [
{
begin: '""'
}
]
}),
hljs.COMMENT(
'\'',
'$',
{
returnBegin: true,
contains: [
{
className: 'doctag',
begin: '\'\'\'|<!--|-->',
contains: [ hljs.PHRASAL_WORDS_MODE ]
},
{
className: 'doctag',
begin: '</?',
end: '>',
contains: [ hljs.PHRASAL_WORDS_MODE ]
}
]
}
),
hljs.C_NUMBER_MODE,
{
className: 'meta',
begin: '#',
end: '$',
keywords: {
'meta-keyword': 'if else elseif end region externalsource'
}
}
CHARACTER,
STRING,
DATE,
NUMBER,
LABEL,
DOC_COMMENT,
COMMENT,
DIRECTIVES
]

@@ -73,0 +212,0 @@ };

@@ -58,2 +58,3 @@ /**

Category: common
Audit: 2020
*/

@@ -65,14 +66,14 @@

const TAG_NAME_RE = concat(/[A-Z_]/, optional(/[A-Z0-9_.-]+:/), /[A-Z0-9_.-]*/);
const XML_IDENT_RE = '[A-Za-z0-9\\._:-]+';
const XML_IDENT_RE = /[A-Za-z0-9._:-]+/;
const XML_ENTITIES = {
className: 'symbol',
begin: '&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;'
begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
};
const XML_META_KEYWORDS = {
begin: '\\s',
begin: /\s/,
contains: [
{
className: 'meta-keyword',
begin: '#?[a-z_][a-z1-9_-]+',
illegal: '\\n'
begin: /#?[a-z_][a-z1-9_-]+/,
illegal: /\n/
}

@@ -82,4 +83,4 @@ ]

const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {
begin: '\\(',
end: '\\)'
begin: /\(/,
end: /\)/
});

@@ -147,4 +148,4 @@ const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, {

className: 'meta',
begin: '<![a-z]',
end: '>',
begin: /<![a-z]/,
end: />/,
relevance: 10,

@@ -157,9 +158,9 @@ contains: [

{
begin: '\\[',
end: '\\]',
begin: /\[/,
end: /\]/,
contains: [
{
className: 'meta',
begin: '<![a-z]',
end: '>',
begin: /<![a-z]/,
end: />/,
contains: [

@@ -177,4 +178,4 @@ XML_META_KEYWORDS,

hljs.COMMENT(
'<!--',
'-->',
/<!--/,
/-->/,
{

@@ -185,4 +186,4 @@ relevance: 10

{
begin: '<!\\[CDATA\\[',
end: '\\]\\]>',
begin: /<!\[CDATA\[/,
end: /\]\]>/,
relevance: 10

@@ -205,4 +206,4 @@ },

*/
begin: '<style(?=\\s|>)',
end: '>',
begin: /<style(?=\s|>)/,
end: />/,
keywords: {

@@ -213,3 +214,3 @@ name: 'style'

starts: {
end: '</style>',
end: /<\/style>/,
returnEnd: true,

@@ -225,4 +226,4 @@ subLanguage: [

// See the comment in the <style tag about the lookahead pattern
begin: '<script(?=\\s|>)',
end: '>',
begin: /<script(?=\s|>)/,
end: />/,
keywords: {

@@ -229,0 +230,0 @@ name: 'script'

@@ -9,5 +9,7 @@ /*

Category: functional
Audit: 2020
*/
function xquery(hljs) {
/** @type LanguageFn */
function xquery(_hljs) {
// see https://www.w3.org/TR/xquery/#id-terminal-delimitation

@@ -62,3 +64,3 @@ const KEYWORDS =

{
begin: /[^<\/\$:'"-]\b(?:abs|accumulator-(?:after|before)|adjust-(?:date(?:Time)?|time)-to-timezone|analyze-string|apply|available-(?:environment-variables|system-properties)|avg|base-uri|boolean|ceiling|codepoints?-(?:equal|to-string)|collation-key|collection|compare|concat|contains(?:-token)?|copy-of|count|current(?:-)?(?:date(?:Time)?|time|group(?:ing-key)?|output-uri|merge-(?:group|key))?data|dateTime|days?-from-(?:date(?:Time)?|duration)|deep-equal|default-(?:collation|language)|distinct-values|document(?:-uri)?|doc(?:-available)?|element-(?:available|with-id)|empty|encode-for-uri|ends-with|environment-variable|error|escape-html-uri|exactly-one|exists|false|filter|floor|fold-(?:left|right)|for-each(?:-pair)?|format-(?:date(?:Time)?|time|integer|number)|function-(?:arity|available|lookup|name)|generate-id|has-children|head|hours-from-(?:dateTime|duration|time)|id(?:ref)?|implicit-timezone|in-scope-prefixes|index-of|innermost|insert-before|iri-to-uri|json-(?:doc|to-xml)|key|lang|last|load-xquery-module|local-name(?:-from-QName)?|(?:lower|upper)-case|matches|max|minutes-from-(?:dateTime|duration|time)|min|months?-from-(?:date(?:Time)?|duration)|name(?:space-uri-?(?:for-prefix|from-QName)?)?|nilled|node-name|normalize-(?:space|unicode)|not|number|one-or-more|outermost|parse-(?:ietf-date|json)|path|position|(?:prefix-from-)?QName|random-number-generator|regex-group|remove|replace|resolve-(?:QName|uri)|reverse|root|round(?:-half-to-even)?|seconds-from-(?:dateTime|duration|time)|snapshot|sort|starts-with|static-base-uri|stream-available|string-?(?:join|length|to-codepoints)?|subsequence|substring-?(?:after|before)?|sum|system-property|tail|timezone-from-(?:date(?:Time)?|time)|tokenize|trace|trans(?:form|late)|true|type-available|unordered|unparsed-(?:entity|text)?-?(?:public-id|uri|available|lines)?|uri-collection|xml-to-json|years?-from-(?:date(?:Time)?|duration)|zero-or-one)\b/
begin: /[^</$:'"-]\b(?:abs|accumulator-(?:after|before)|adjust-(?:date(?:Time)?|time)-to-timezone|analyze-string|apply|available-(?:environment-variables|system-properties)|avg|base-uri|boolean|ceiling|codepoints?-(?:equal|to-string)|collation-key|collection|compare|concat|contains(?:-token)?|copy-of|count|current(?:-)?(?:date(?:Time)?|time|group(?:ing-key)?|output-uri|merge-(?:group|key))?data|dateTime|days?-from-(?:date(?:Time)?|duration)|deep-equal|default-(?:collation|language)|distinct-values|document(?:-uri)?|doc(?:-available)?|element-(?:available|with-id)|empty|encode-for-uri|ends-with|environment-variable|error|escape-html-uri|exactly-one|exists|false|filter|floor|fold-(?:left|right)|for-each(?:-pair)?|format-(?:date(?:Time)?|time|integer|number)|function-(?:arity|available|lookup|name)|generate-id|has-children|head|hours-from-(?:dateTime|duration|time)|id(?:ref)?|implicit-timezone|in-scope-prefixes|index-of|innermost|insert-before|iri-to-uri|json-(?:doc|to-xml)|key|lang|last|load-xquery-module|local-name(?:-from-QName)?|(?:lower|upper)-case|matches|max|minutes-from-(?:dateTime|duration|time)|min|months?-from-(?:date(?:Time)?|duration)|name(?:space-uri-?(?:for-prefix|from-QName)?)?|nilled|node-name|normalize-(?:space|unicode)|not|number|one-or-more|outermost|parse-(?:ietf-date|json)|path|position|(?:prefix-from-)?QName|random-number-generator|regex-group|remove|replace|resolve-(?:QName|uri)|reverse|root|round(?:-half-to-even)?|seconds-from-(?:dateTime|duration|time)|snapshot|sort|starts-with|static-base-uri|stream-available|string-?(?:join|length|to-codepoints)?|subsequence|substring-?(?:after|before)?|sum|system-property|tail|timezone-from-(?:date(?:Time)?|time)|tokenize|trace|trans(?:form|late)|true|type-available|unordered|unparsed-(?:entity|text)?-?(?:public-id|uri|available|lines)?|uri-collection|xml-to-json|years?-from-(?:date(?:Time)?|duration)|zero-or-one)\b/
},

@@ -95,3 +97,3 @@ {

className: 'number',
begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b',
begin: /(\b0[0-7_]+)|(\b0x[0-9a-fA-F_]+)|(\b[1-9][0-9_]*(\.[0-9_]+)?)|[0_]\b/,
relevance: 0

@@ -133,4 +135,4 @@ };

className: 'comment',
begin: '\\(:',
end: ':\\)',
begin: /\(:/,
end: /:\)/,
relevance: 10,

@@ -140,3 +142,3 @@ contains: [

className: 'doctag',
begin: '@\\w+'
begin: /@\w+/
}

@@ -157,4 +159,4 @@ ]

const DIRECT = {
begin: /<([\w\._:\-]+)(\s+\S*=('|").*('|"))?>/,
end: /(\/[\w\._:\-]+>)/,
begin: /<([\w._:-]+)(\s+\S*=('|").*('|"))?>/,
end: /(\/[\w._:-]+>)/,
subLanguage: 'xml',

@@ -192,3 +194,3 @@ contains: [

keywords: {
$pattern: /[a-zA-Z\$][a-zA-Z0-9_:\-]*/,
$pattern: /[a-zA-Z$][a-zA-Z0-9_:-]*/,
keyword: KEYWORDS,

@@ -195,0 +197,0 @@ type: TYPE,

@@ -6,4 +6,6 @@ /*

Website: https://zephir-lang.com/en
Audit: 2020
*/
/** @type LanguageFn */
function zephir(hljs) {

@@ -63,4 +65,4 @@ const STRING = {

hljs.COMMENT(
'/\\*',
'\\*/',
/\/\*/,
/\*\//,
{

@@ -70,3 +72,3 @@ contains: [

className: 'doctag',
begin: '@[A-Za-z]+'
begin: /@[A-Za-z]+/
}

@@ -78,4 +80,4 @@ ]

className: 'string',
begin: '<<<[\'"]?\\w+[\'"]?$',
end: '^\\w+;',
begin: /<<<['"]?\w+['"]?$/,
end: /^\w+;/,
contains: [ hljs.BACKSLASH_ESCAPE ]

@@ -92,3 +94,3 @@ },

excludeEnd: true,
illegal: '\\$|\\[|%',
illegal: /\$|\[|%/,
contains: [

@@ -98,4 +100,4 @@ TITLE_MODE,

className: 'params',
begin: '\\(',
end: '\\)',
begin: /\(/,
end: /\)/,
keywords: KEYWORDS,

@@ -116,3 +118,3 @@ contains: [

excludeEnd: true,
illegal: /[:\(\$"]/,
illegal: /[:($"]/,
contains: [

@@ -127,4 +129,4 @@ {

beginKeywords: 'namespace',
end: ';',
illegal: /[\.']/,
end: /;/,
illegal: /[.']/,
contains: [ TITLE_MODE ]

@@ -134,7 +136,7 @@ },

beginKeywords: 'use',
end: ';',
end: /;/,
contains: [ TITLE_MODE ]
},
{
begin: '=>' // No markup, just a relevance booster
begin: /=>/ // No markup, just a relevance booster
},

@@ -141,0 +143,0 @@ STRING,

{
"name": "highlight.js",
"description": "Syntax highlighting with language autodetection.",
"keywords": [
"highlight",
"syntax"
],
"homepage": "https://highlightjs.org/",
"version": "10.4.1",
"author": {
"name": "Ivan Sagalaev",
"email": "maniac@softwaremaniacs.org"
},
"contributors": [
{
"name": "Egor Rogov",
"email": "e.rogov@postgrespro.ru"
},
{
"name": "Vladimir Jimenez",
"email": "me@allejo.io"
},
{
"name": "Jeremy Hull",
"email": "sourdrums@gmail.com"
},
{
"name": "Oleg Efimov",
"email": "efimovov@gmail.com"
},
{
"name": "Gidi Meir Morris",
"email": "gidi@gidi.io"
},
{
"name": "Jan T. Sott",
"email": "git@idleberg.com"
},
{
"name": "Li Xuanji",
"email": "xuanji@gmail.com"
},
{
"name": "Marcos Cáceres",
"email": "marcos@marcosc.com"
},
{
"name": "Sang Dang",
"email": "sang.dang@polku.io"
},
{
"name": "Peter Leonov",
"email": "gojpeg@gmail.com"
},
{
"name": "Vanessa Sochat",
"email": "@vsoch"
},
{
"name": "Victor Karamzin",
"email": "Victor.Karamzin@enterra-inc.com"
},
{
"name": "Vsevolod Solovyov",
"email": "vsevolod.solovyov@gmail.com"
},
{
"name": "Anton Kovalyov",
"email": "anton@kovalyov.net"
},
{
"name": "Nikita Ledyaev",
"email": "lenikita@yandex.ru"
},
{
"name": "Konstantin Evdokimenko",
"email": "qewerty@gmail.com"
},
{
"name": "Dmitri Roudakov",
"email": "dmitri@roudakov.ru"
},
{
"name": "Yuri Ivanov",
"email": "ivanov@supersoft.ru"
},
{
"name": "Vladimir Ermakov",
"email": "vooon341@mail.ru"
},
{
"name": "Vladimir Gubarkov",
"email": "xonixx@gmail.com"
},
{
"name": "Brian Beck",
"email": "exogen@gmail.com"
},
{
"name": "MajestiC",
"email": "majestic2k@gmail.com"
},
{
"name": "Vasily Polovnyov",
"email": "vast@whiteants.net"
},
{
"name": "Vladimir Epifanov",
"email": "voldmar@voldmar.ru"
},
{
"name": "Alexander Makarov",
"email": "sam@rmcreative.ru"
},
{
"name": "Vah",
"email": "vahtenberg@gmail.com"
},
{
"name": "Shuen-Huei Guan",
"email": "drake.guan@gmail.com"
},
{
"name": "Jason Diamond",
"email": "jason@diamond.name"
},
{
"name": "Michal Gabrukiewicz",
"email": "mgabru@gmail.com"
},
{
"name": "Ruslan Keba",
"email": "rukeba@gmail.com"
},
{
"name": "Sergey Baranov",
"email": "segyrn@yandex.ru"
},
{
"name": "Zaripov Yura",
"email": "yur4ik7@ukr.net"
},
{
"name": "Oleg Volchkov",
"email": "oleg@volchkov.net"
},
{
"name": "Vasily Mikhailitchenko",
"email": "vaskas@programica.ru"
},
{
"name": "Jan Berkel",
"email": "jan.berkel@gmail.com"
},
{
"name": "Vladimir Moskva",
"email": "vladmos@gmail.com"
},
{
"name": "Loren Segal",
"email": "lsegal@soen.ca"
},
{
"name": "Andrew Fedorov",
"email": "dmmdrs@mail.ru"
},
{
"name": "Igor Kalnitsky",
"email": "igor@kalnitsky.org"
},
{
"name": "Valerii Hiora",
"email": "valerii.hiora@gmail.com"
},
{
"name": "Nikolay Zakharov",
"email": "nikolay.desh@gmail.com"
},
{
"name": "Dmitry Kovega",
"email": "arhibot@gmail.com"
},
{
"name": "Sergey Ignatov",
"email": "sergey@ignatov.spb.su"
},
{
"name": "Antono Vasiljev",
"email": "self@antono.info"
},
{
"name": "Stephan Kountso",
"email": "steplg@gmail.com"
},
{
"name": "pumbur",
"email": "pumbur@pumbur.net"
},
{
"name": "John Crepezzi",
"email": "john.crepezzi@gmail.com"
},
{
"name": "Andrey Vlasovskikh",
"email": "andrey.vlasovskikh@gmail.com"
},
{
"name": "Alexander Myadzel",
"email": "myadzel@gmail.com"
},
{
"name": "Evgeny Stepanischev",
"email": "imbolk@gmail.com"
},
{
"name": "Dmytrii Nagirniak",
"email": "dnagir@gmail.com"
},
{
"name": "Luigi Maselli",
"email": "grigio.org@gmail.com"
},
{
"name": "Denis Bardadym",
"email": "bardadymchik@gmail.com"
},
{
"name": "Aahan Krish",
"email": "geekpanth3r@gmail.com"
},
{
"name": "Ilya Baryshev",
"email": "baryshev@gmail.com"
},
{
"name": "Aleksandar Ruzicic",
"email": "aleksandar@ruzicic.info"
},
{
"name": "Joe Cheng",
"email": "joe@rstudio.org"
},
{
"name": "Angel G. Olloqui",
"email": "angelgarcia.mail@gmail.com"
},
{
"name": "Jason Tate",
"email": "adminz@web-cms-designs.com"
},
{
"name": "Sergey Tikhomirov",
"email": "sergey@tikhomirov.io"
},
{
"name": "Marc Fornos",
"email": "marc.fornos@gmail.com"
},
{
"name": "Yoshihide Jimbo",
"email": "yjimbo@gmail.com"
},
{
"name": "Casey Duncan",
"email": "casey.duncan@gmail.com"
},
{
"name": "Eugene Nizhibitsky",
"email": "nizhibitsky@gmail.com"
},
{
"name": "Alberto Gimeno",
"email": "gimenete@gmail.com"
},
{
"name": "Kirk Kimmel",
"email": "kimmel.k.programmer@gmail.com"
},
{
"name": "Nathan Grigg",
"email": "nathan@nathanamy.org"
},
{
"name": "Dr. Drang",
"email": "drdrang@gmail.com"
},
{
"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ø",
"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édric Néhémie",
"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"
},
{
"name": "Mehdi Dogguy",
"email": "mehdi@dogguy.org"
},
{
"name": "Nicolas Braud-Santoni",
"email": "nicolas.braud-santoni@ens-cachan.fr"
},
{
"name": "Ralf Bitter",
"email": "rabit@revigniter.com"
},
{
"name": "Sylvestre Ledru",
"email": "sylvestre.ledru@scilab-enterprises.com"
},
{
"name": "Troy Kershaw",
"email": "hello@troykershaw.com"
},
{
"name": "Zena Treep",
"email": "zena.treep@gmail.com"
},
{
"name": "Daniel Kvasnicka",
"email": "dkvasnicka@vendavo.com"
},
{
"name": "Carlo Kok",
"email": "ck@remobjects.com"
},
{
"name": "Bram de Haan",
"email": "info@atelierbramdehaan.nl"
},
{
"name": "Seongwon Lee",
"email": "dlimpid@gmail.com"
},
{
"name": "Zaven Muradyan",
"email": "megalivoithos@gmail.com"
},
{
"name": "Brent Bradbury",
"email": "brent@brentium.com"
},
{
"name": "Martin Dilling-Hansen",
"email": "martindlling@gmail.com"
},
{
"name": "Ilya Vassilevsky",
"email": "vassilevsky@gmail.com"
},
{
"name": "Josh Adams",
"email": "josh@isotope11.com"
},
{
"name": "Dan Tao",
"email": "daniel.tao@gmail.com"
},
{
"name": "Jeff Escalante",
"email": "hello@jenius.me"
},
{
"name": "Jun Yang",
"email": "yangjvn@126.com"
},
{
"name": "Nikolay Lisienko",
"email": "info@neor.ru"
},
{
"name": "Heiko August",
"email": "post@auge8472.de"
},
{
"name": "Domen Kožar",
"email": "domen@dev.si"
},
{
"name": "Travis Odom",
"email": "travis.a.odom@gmail.com"
},
{
"name": "innocenat",
"email": "innocenat@gmail.com"
},
{
"name": "Arthur Bikmullin",
"email": "devolonter@gmail.com"
},
{
"name": "Pascal Hurni",
"email": "phi@ruby-reactive.org"
},
{
"name": "Roman Shmatov",
"email": "romanshmatov@gmail.com"
},
{
"name": "Nic West",
"email": "nic@letolab.com"
},
{
"name": "Panu Horsmalahti",
"email": "panu.horsmalahti@iki.fi"
},
{
"name": "Flaviu Tamas",
"email": "tamas.flaviu@gmail.com"
},
{
"name": "Damian Mee",
"email": "mee.damian@gmail.com"
},
{
"name": "Christopher Kaster",
"email": "ikasoki@gmail.com"
},
{
"name": "Chris Eidhof",
"email": "chris@eidhof.nl"
},
{
"name": "Nate Cook",
"email": "natecook@gmail.com"
},
{
"name": "Matt Diephouse",
"email": "matt@diephouse.com"
},
{
"name": "Erik Osheim",
"email": "d_m@plastic-idolatry.com"
},
{
"name": "Guillaume Laforge",
"email": "glaforge@gmail.com"
},
{
"name": "Lucas Mazza",
"email": "lucastmazza@gmail.com"
},
{
"name": "Maxim Dikun",
"email": "dikmax@gmail.com"
},
{
"name": "Henrik Feldt",
"email": "henrik@haf.se"
},
{
"name": "Anton Kochkov",
"email": "anton.kochkov@gmail.com"
},
{
"name": "Michael Allen",
"email": "Michael.Allen@benefitfocus.com"
},
{
"name": "JP Verkamp",
"email": "me@jverkamp.com"
},
{
"name": "Adam Joseph Cook",
"email": "adam.joseph.cook@gmail.com"
},
{
"name": "Sergey Vidyuk",
"email": "svidyuk@gmail.com"
},
{
"name": "Radek Liska",
"email": "radekliska@gmail.com"
},
{
"name": "Jose Molina Colmenero",
"email": "gaudy41@gmail.com"
},
{
"name": "Max Mikhailov",
"email": "seven.phases.max@gmail.com"
},
{
"name": "Bryant Williams",
"email": "b.n.williams@gmail.com"
},
{
"name": "Erik Paluka",
"email": "erik.paluka@gmail.com"
},
{
"name": "Luke Holder",
"email": "lukemh@gmail.com"
},
{
"name": "David Mohundro",
"email": "david@mohundro.com"
},
{
"name": "Nicholas Blumhardt",
"email": "nblumhardt@nblumhardt.com"
},
{
"name": "Christophe de Dinechin",
"email": "christophe@taodyne.com"
},
{
"name": "Taneli Vatanen",
"email": "taneli.vatanen@gmail.com"
},
{
"name": "Jen Evers-Corvina",
"email": "jen@sevvie.net"
},
{
"name": "Kassio Borges",
"email": "kassioborgesm@gmail.com"
},
{
"name": "Cedric Sohrauer",
"email": "sohrauer@googlemail.com"
},
{
"name": "Mickaël Delahaye",
"email": "mickael.delahaye@gmail.com"
},
{
"name": "Hakan Özler",
"email": "ozler.hakan@gmail.com"
},
{
"name": "Trey Shugart",
"email": "treshugart@gmail.com"
},
{
"name": "Vincent Zurczak",
"email": "vzurczak@linagora.com"
},
{
"name": "Adam Joseph Cook",
"email": "adam.joseph.cook@gmail.com"
},
{
"name": "Edwin Dalorzo",
"email": "edwin@dalorzo.org"
},
{
"name": "mucaho",
"email": "mkucko@gmail.com"
},
{
"name": "Dennis Titze",
"email": "dennis.titze@gmail.com"
},
{
"name": "Jon Evans",
"email": "jon@craftyjon.com"
},
{
"name": "Brian Quistorff",
"email": "bquistorff@gmail.com"
},
{
"name": "Jonathan Suever",
"email": "suever@gmail.com"
},
{
"name": "Alexis Hénaut",
"email": "alexis@henaut.net"
},
{
"name": "Chris Kiehl",
"email": "audionautic@gmail.com"
},
{
"name": "Peter Piwowarski",
"email": "oldlaptop654@aol.com"
},
{
"name": "Kenta Sato",
"email": "bicycle1885@gmail.com"
},
{
"name": "Anthony Scemama",
"email": "scemama@irsamc.ups-tlse.fr"
},
{
"name": "Taufik Nurrohman",
"email": "latitudu.latitudu@gmail.com"
},
{
"name": "Pedro Oliveira",
"email": "kanytu@gmail.com"
},
{
"name": "Gu Yiling",
"email": "justice360@gmail.com"
},
{
"name": "Thomas Applencourt",
"email": "thomas.applencourt@irsamc.ups-tlse.fr"
},
{
"name": "Andrew Farmer",
"email": "ahfarmer@gmail.com"
},
{
"name": "Sergey Mashkov",
"email": "cy6erGn0m@gmail.com"
},
{
"name": "Raivo Laanemets",
"email": "raivo@infdot.com"
},
{
"name": "Kenneth Fuglsang",
"email": "kfuglsang@gmail.com"
},
{
"name": "David Anson",
"email": "david@dlaa.me"
},
{
"name": "Louis Barranqueiro",
"email": "louis.barranqueiro@gmail.com"
},
{
"name": "Tim Schumacher",
"email": "tim@datenknoten.me"
},
{
"name": "Lucas Werkmeister",
"email": "mail@lucaswerkmeister.de"
},
{
"name": "Dan Panzarella",
"email": "alsoelp@gmail.com"
},
{
"name": "Bruno Dias",
"email": "bruno.r.dias@gmail.com"
},
{
"name": "Jay Strybis",
"email": "jay.strybis@gmail.com"
},
{
"name": "Guillaume Gomez",
"email": "guillaume1.gomez@gmail.com"
},
{
"name": "Janis Voigtländer",
"email": "janis.voigtlaender@gmail.com"
},
{
"name": "Dirk Kirsten",
"email": "dk@basex.org"
},
{
"name": "MY Sun",
"email": "simonmysun@gmail.com"
},
{
"name": "Vadimtro",
"email": "vadimtro@yahoo.com"
},
{
"name": "Benjamin Auder",
"email": "benjamin.auder@gmail.com"
},
{
"name": "Dotan Dimet",
"email": "dotan@corky.net"
},
{
"name": "Manh Tuan",
"email": "junookyo@gmail.com"
},
{
"name": "Philippe Charrière",
"email": "ph.charriere@gmail.com"
},
{
"name": "Stefan Bechert",
"email": "stefan.bechert@gmx.net"
},
{
"name": "Samuel Reed",
"email": "sam@bitmex.com"
},
{
"name": "Yury Selivanov",
"email": "yselivanov@gmail.com"
},
{
"name": "Tsuyusato Kitsune",
"email": "make.just.on@gmail.com"
},
{
"name": "Mick MacCallum",
"email": "micksmaccallum@gmail.com"
},
{
"name": "Kristoffer Gronlund",
"email": "kgronlund@suse.com"
},
{
"name": "Søren Enevoldsen",
"email": "senevoldsen90@gmail.com"
},
{
"name": "Daniel Rosenwasser",
"email": "DanielRosenwasser@users.noreply.github.com"
},
{
"name": "Ladislav Prskavec",
"email": "ladislav@prskavec.net"
},
{
"name": "Jan Kühle",
"email": "jkuehle90@gmail.com"
},
{
"name": "Stefan Wienert",
"email": "stwienert@gmail.com"
},
{
"name": "Nikita Savchenko",
"email": "zitros.lab@gmail.com"
},
{
"name": "Stefania Mellai",
"email": "s.mellai@arduino.cc"
},
{
"name": "Nebuleon Fumika",
"email": "nebuleon.fumika@gmail.com"
},
{
"name": "prince",
"email": "MC.prince.0203@gmail.com"
},
{
"name": "Brendan Rocks",
"email": "rocks.brendan@gmail.com"
},
{
"name": "Raphaël Assénat",
"email": "raph@raphnet.net"
},
{
"name": "Matt Evans",
"email": "matt@aptech.com"
},
{
"name": "Martin Braun",
"email": "martin.braun@ettus.com"
},
{
"name": "Boris Cherny",
"email": "boris@performancejs.com"
},
{
"name": "John Foster",
"email": "jfoster@esri.com"
},
{
"name": "Robert Dodier",
"email": "robert.dodier@gmail.com"
},
{
"name": "Anthony Dugois",
"email": "dev.anthonydugois@gmail.com"
},
{
"name": "Qeole",
"email": "qeole@outlook.com"
},
{
"name": "Denis Ciccale",
"email": "dciccale@gmail.com"
},
{
"name": "Michael Johnston",
"email": "lastobelus@gmail.com"
},
{
"name": "Taras",
"email": "oxdef@oxdef.info"
},
{
"name": "Philipp Wolfer",
"email": "ph.wolfer@gmail.com"
},
{
"name": "Mikko Kouhia",
"email": "mikko.kouhia@iki.fi"
},
{
"name": "Billy Quith",
"email": "chinbillybilbo@gmail.com"
},
{
"name": "Herbert Shin",
"email": "initbar@protonmail.ch"
},
{
"name": "Tristano Ajmone",
"email": "tajmone@gmail.com"
},
{
"name": "Taisuke Fujimoto",
"email": "temp-impl@users.noreply.github.com"
},
{
"name": "Boone Severson",
"email": "boone.severson@gmail.com"
},
{
"name": "Victor Zhou",
"email": "OiCMudkips@users.noreply.github.com"
},
{
"name": "Lars Schulna",
"email": "kartoffelbrei.mit.muskatnuss@gmail.org"
},
{
"name": "Jacob Childress",
"email": "jacobc@gmail.com"
},
{
"name": "Gavin Siu",
"email": "gavsiu@gmail.com"
},
{
"name": "Builder's Brewery",
"email": "buildersbrewery@gmail.com"
},
{
"name": "Sergey Bronnikov",
"email": "sergeyb@bronevichok.ru"
},
{
"name": "Joe Eli McIlvain",
"email": "joe.eli.mac@gmail.org"
},
{
"name": "Stephan Boyer",
"email": "stephan@stephanboyer.com"
},
{
"name": "Alex McKibben",
"email": "alex@nullscope.net"
},
{
"name": "Daniel Gamage",
"email": "hellodanielgamage@gmail.com"
},
{
"name": "Matthew Daly",
"email": "matthewbdaly@gmail.com"
},
{
"name": "Magnus Madsen",
"email": "mmadsen@uwaterloo.ca"
},
{
"name": "Camil Staps",
"email": "info@camilstaps.nl"
},
{
"name": "Alexander Lichter",
"email": "manniL@gmx.net"
},
{
"name": "Nicolas Le Gall",
"email": "contact@nlegall.fr"
},
{
"name": "Kenton Hamaluik",
"email": "kentonh@gmail.com"
},
{
"name": "Marvin Saignat",
"email": "contact@zgmrvn.com"
},
{
"name": "Michael Rodler",
"email": "contact@f0rki.at"
},
{
"name": "Sergey Sobko",
"email": "s.sobko@profitware.ru"
},
{
"name": "Hale Chan",
"email": "halechan@qq.com"
},
{
"name": "Kasper Andersen",
"email": "kma_untrusted@protonmail.com"
},
{
"name": "Philipp A.",
"email": "flying-sheep@web.de"
},
{
"name": "Guannan Wei",
"email": "guannanwei@outlook.com"
},
{
"name": "Sam Wu",
"email": "samsam2310@gmail.com"
},
{
"name": "Ike Ku",
"email": "dempfi@yahoo.com"
},
{
"name": "Andres Täht",
"email": "andres.taht@gmail.com"
},
{
"name": "Rene Saarsoo",
"email": "nene@triin.net"
},
{
"name": "Jordi Petit",
"email": "jordi.petit@gmail.com"
},
{
"name": "Raphaël Parrëe",
"email": "rparree@edc4it.com"
},
{
"name": "Joël Porquet",
"email": "joel@porquet.org"
},
{
"name": "Alex Arslan",
"email": "ararslan@comcast.net"
},
{
"name": "Stanislav Belov",
"email": "stbelov@gmail.com"
},
{
"name": "Ivan Dementev",
"email": "ivan_div@mail.ru"
},
{
"name": "Nicolas LLOBERA",
"email": "nllobera@gmail.com"
},
{
"name": "Morten Piibeleht",
"email": "morten.piibeleht@gmail.com"
},
{
"name": "Martin Clausen",
"email": "martin.clausene@gmail.com"
},
{
"name": "Arctic Ice Studio",
"email": "development@arcticicestudio.com"
},
{
"name": "Google Inc. (David Benjamin)",
"email": "davidben@google.com"
},
{
"name": "Ahmad Awais",
"email": "me@AhmadAwais.com"
},
{
"name": "Duncan Paterson",
"email": "duncan@exist-db.org"
},
{
"name": "Tristian Kelly",
"email": "tristian.kelly560@gmail.com"
},
{
"name": "Melissa Geels",
"email": "melissa@nimble.tools"
},
{
"name": "Dmitriy Tarasov",
"email": "dimatar@gmail.com"
},
{
"name": "Egor Rogov",
"email": "e.rogov@postgrespro.ru"
},
{
"name": "Meseta",
"email": "meseta@gmail.com"
},
{
"name": "Harmon",
"email": "Harmon.Public@gmail.com"
},
{
"name": "Eric Bailey",
"email": "eric.w.bailey@gmail.com"
},
{
"name": "Gustavo Costa",
"email": "gusbemacbe@gmail.com"
},
{
"name": "Jeffrey Arnold",
"email": "jeffrey.arnold@gmail.com"
},
{
"name": "Antoine Boisier-Michaud",
"email": "aboisiermichaud@gmail.com"
},
{
"name": "Alejandro Isaza",
"email": "al@isaza.ca"
},
{
"name": "Laurent Voullemier",
"email": "laurent.voullemier@gmail.com"
},
{
"name": "Sean T. Allen",
"email": "sean@monkeysnatchbanana.com"
},
{
"name": "Greg Cline",
"email": "gregrcline@gmail.com"
},
{
"name": "Sejin Jeon",
"email": "jinaidy93@gmail.com"
},
{
"name": "Taif Alimov",
"email": "inzeppelin@gmail.com"
},
{
"name": "Yuri Mazursky",
"email": "mail@colomolome.com"
},
{
"name": "Carl Baxter",
"email": "carl@cbax.tech"
},
{
"name": "Thomas Reichel",
"email": "tom.p.reichel@gmail.com"
},
{
"name": "G8t Guy",
"email": "g8tguy@g8tguy.com"
},
{
"name": "Samia Ali",
"email": "samiaab1990@gmail.com"
},
{
"name": "Alexandre Grison",
"email": "a.grison@gmail.com"
},
{
"name": "Jim Mason",
"email": "jmason@ibinx.com"
},
{
"name": "lioshi",
"email": "lioshi@lioshi.com"
},
{
"name": "David Pine",
"email": "david.pine.7@gmail.com"
},
{
"name": "Konrad Rudolph",
"email": "konrad.rudolph@gmail.com"
},
{
"name": "Tom Wallace",
"email": "thomasmichaelwallace@gmail.com"
},
{
"name": "Michael Newton",
"email": "miken32@github"
},
{
"name": "Richard Gibson",
"email": "gibson042@github"
},
{
"name": "Fredrik Ekre",
"email": "ekrefredrik@gmail.com"
},
{
"name": "Jan Pilzer",
"email": "Hirse@github"
},
{
"name": "Jonathan Sharpe",
"email": "mail@jonrshar.pe"
},
{
"name": "Michael Rush",
"email": "michaelrush@gmail.com"
},
{
"name": "Florian Bezdeka",
"email": "florian@bezdeka.de"
},
{
"name": "Marat Nagayev",
"email": "nagaevmt@yandex.ru"
},
{
"name": "Patrick Scheibe",
"email": "patrick@halirutan.de"
},
{
"name": "Kyle Brown",
"email": "kylebrown9@github"
},
{
"name": "Marcus Ortiz",
"email": "mportiz08@gmail.com"
},
{
"name": "Guillaume Grossetie",
"email": "ggrossetie@yuzutech.fr"
}
],
"bugs": {
"url": "https://github.com/highlightjs/highlight.js/issues"
},
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "git://github.com/highlightjs/highlight.js.git"
},
"main": "./lib/index.js",
"types": "./types/index.d.ts",
"scripts": {
"mocha": "mocha",
"lint": "eslint -c .eslintrc.js src/*.js src/lib/*.js",
"build_and_test": "npm run build && npm run test",
"build": "node ./tools/build.js -t node",
"build-cdn": "node ./tools/build.js -t cdn",
"build-browser": "node ./tools/build.js -t browser :common",
"test": "mocha test",
"test-markup": "mocha test/markup",
"test-detect": "mocha test/detect",
"test-browser": "mocha test/browser",
"test-parser": "mocha test/parser"
},
"engines": {
"node": "*"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"clean-css": "^4.2.3",
"cli-table": "^0.3.1",
"colors": "^1.1.2",
"commander": "^6.2.0",
"deep-freeze-es6": "^1.4.1",
"del": "^6.0.0",
"dependency-resolver": "^2.0.1",
"eslint": "^7.12.1",
"eslint-config-standard": "^16.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.2",
"glob": "^7.1.6",
"glob-promise": "^3.4.0",
"handlebars": "^4.7.6",
"js-beautify": "^1.13.0",
"jsdom": "^16.4.0",
"lodash": "^4.17.20",
"mocha": "^8.2.1",
"refa": "^0.4.1",
"rollup": "^2.33.1",
"should": "^13.2.3",
"terser": "^5.3.8",
"tiny-worker": "^2.3.0",
"typescript": "^4.0.5"
},
"dependencies": {}
"name": "highlight.js",
"description": "Syntax highlighting with language autodetection.",
"keywords": [
"highlight",
"syntax"
],
"homepage": "https://highlightjs.org/",
"version": "10.5.0",
"author": {
"name": "Ivan Sagalaev",
"email": "maniac@softwaremaniacs.org"
},
"contributors": [
"Josh Goebel <hello@joshgoebel.com>",
"Egor Rogov <e.rogov@postgrespro.ru>",
"Vladimir Jimenez <me@allejo.io>",
"Ivan Sagalaev <maniac@softwaremaniacs.org>",
"Jeremy Hull <sourdrums@gmail.com>",
"Oleg Efimov <efimovov@gmail.com>",
"Gidi Meir Morris <gidi@gidi.io>",
"Jan T. Sott <git@idleberg.com>",
"Li Xuanji <xuanji@gmail.com>",
"Marcos Cáceres <marcos@marcosc.com>",
"Sang Dang <sang.dang@polku.io>",
"Peter Leonov <gojpeg@gmail.com>",
"Vanessa Sochat (https://github.com/vsoch)",
"Victor Karamzin <Victor.Karamzin@enterra-inc.com>",
"Vsevolod Solovyov <vsevolod.solovyov@gmail.com>",
"Anton Kovalyov <anton@kovalyov.net>",
"Nikita Ledyaev <lenikita@yandex.ru>",
"Konstantin Evdokimenko <qewerty@gmail.com>",
"Dmitri Roudakov <dmitri@roudakov.ru>",
"Yuri Ivanov <ivanov@supersoft.ru>",
"Vladimir Ermakov <vooon341@mail.ru>",
"Vladimir Gubarkov <xonixx@gmail.com>",
"Brian Beck <exogen@gmail.com>",
"MajestiC <majestic2k@gmail.com>",
"Vasily Polovnyov <vast@whiteants.net>",
"Vladimir Epifanov <voldmar@voldmar.ru>",
"Alexander Makarov <sam@rmcreative.ru>",
"Vah <vahtenberg@gmail.com>",
"Shuen-Huei Guan <drake.guan@gmail.com>",
"Jason Diamond <jason@diamond.name>",
"Michal Gabrukiewicz <mgabru@gmail.com>",
"Ruslan Keba <rukeba@gmail.com>",
"Sergey Baranov <segyrn@yandex.ru>",
"Zaripov Yura <yur4ik7@ukr.net>",
"Oleg Volchkov <oleg@volchkov.net>",
"Vasily Mikhailitchenko <vaskas@programica.ru>",
"Jan Berkel <jan.berkel@gmail.com>",
"Vladimir Moskva <vladmos@gmail.com>",
"Loren Segal <lsegal@soen.ca>",
"Andrew Fedorov <dmmdrs@mail.ru>",
"Igor Kalnitsky <igor@kalnitsky.org>",
"Valerii Hiora <valerii.hiora@gmail.com>",
"Nikolay Zakharov <nikolay.desh@gmail.com>",
"Dmitry Kovega <arhibot@gmail.com>",
"Sergey Ignatov <sergey@ignatov.spb.su>",
"Antono Vasiljev <self@antono.info>",
"Stephan Kountso <steplg@gmail.com>",
"pumbur <pumbur@pumbur.net>",
"John Crepezzi <john.crepezzi@gmail.com>",
"Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>",
"Alexander Myadzel <myadzel@gmail.com>",
"Evgeny Stepanischev <imbolk@gmail.com>",
"Dmytrii Nagirniak <dnagir@gmail.com>",
"Luigi Maselli <grigio.org@gmail.com>",
"Denis Bardadym <bardadymchik@gmail.com>",
"Aahan Krish <geekpanth3r@gmail.com>",
"Ilya Baryshev <baryshev@gmail.com>",
"Aleksandar Ruzicic <aleksandar@ruzicic.info>",
"Joe Cheng <joe@rstudio.org>",
"Angel G. Olloqui <angelgarcia.mail@gmail.com>",
"Jason Tate <adminz@web-cms-designs.com>",
"Sergey Tikhomirov <sergey@tikhomirov.io>",
"Marc Fornos <marc.fornos@gmail.com>",
"Yoshihide Jimbo <yjimbo@gmail.com>",
"Casey Duncan <casey.duncan@gmail.com>",
"Eugene Nizhibitsky <nizhibitsky@gmail.com>",
"Alberto Gimeno <gimenete@gmail.com>",
"Kirk Kimmel <kimmel.k.programmer@gmail.com>",
"Nathan Grigg <nathan@nathanamy.org>",
"Dr. Drang <drdrang@gmail.com>",
"Robin Ward <robin.ward@gmail.com>",
"Dmitry Medvinsky <me@dmedvinsky.name>",
"Jason Jacobson <jason.a.jacobson@gmail.com>",
"Jonas Follesø <jonas@follesoe.no>",
"Dan Allen <dan.j.allen@gmail.com>",
"noformnocontent <i@noformnocontent.com>",
"Damien White <damien.white@visoftinc.com>",
"Alexander Marenin <great_muchacho@mail.ru>",
"Cédric Néhémie <cedric.nehemie@gmail.com>",
"Simon Madine <simon@angryrobotzombie.com>",
"Benjamin Pannell <contact@sierrasoftworks.com>",
"Eric Knibbe <eric@lassosoft.com>",
"Poren Chiang <ren.chiang@gmail.com>",
"Kelley van Evert <kelleyvanevert@gmail.com>",
"Kurt Emch <kurt@kurtemch.com>",
"Mehdi Dogguy <mehdi@dogguy.org>",
"Nicolas Braud-Santoni <nicolas.braud-santoni@ens-cachan.fr>",
"Ralf Bitter <rabit@revigniter.com>",
"Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com>",
"Troy Kershaw <hello@troykershaw.com>",
"Zena Treep <zena.treep@gmail.com>",
"Daniel Kvasnicka <dkvasnicka@vendavo.com>",
"Carlo Kok <ck@remobjects.com>",
"Bram de Haan <info@atelierbramdehaan.nl>",
"Seongwon Lee <dlimpid@gmail.com>",
"Zaven Muradyan <megalivoithos@gmail.com>",
"Brent Bradbury <brent@brentium.com>",
"Martin Dilling-Hansen <martindlling@gmail.com>",
"Ilya Vassilevsky <vassilevsky@gmail.com>",
"Josh Adams <josh@isotope11.com>",
"Dan Tao <daniel.tao@gmail.com>",
"Jeff Escalante <hello@jenius.me>",
"Jun Yang <yangjvn@126.com>",
"Nikolay Lisienko <info@neor.ru>",
"Heiko August <post@auge8472.de>",
"Domen Kožar <domen@dev.si>",
"Travis Odom <travis.a.odom@gmail.com>",
"innocenat <innocenat@gmail.com>",
"Arthur Bikmullin <devolonter@gmail.com>",
"Pascal Hurni <phi@ruby-reactive.org>",
"Roman Shmatov <romanshmatov@gmail.com>",
"Nic West <nic@letolab.com>",
"Panu Horsmalahti <panu.horsmalahti@iki.fi>",
"Flaviu Tamas <tamas.flaviu@gmail.com>",
"Damian Mee <mee.damian@gmail.com>",
"Christopher Kaster <ikasoki@gmail.com>",
"Chris Eidhof <chris@eidhof.nl>",
"Nate Cook <natecook@gmail.com>",
"Matt Diephouse <matt@diephouse.com>",
"Erik Osheim <d_m@plastic-idolatry.com>",
"Guillaume Laforge <glaforge@gmail.com>",
"Lucas Mazza <lucastmazza@gmail.com>",
"Maxim Dikun <dikmax@gmail.com>",
"Henrik Feldt <henrik@haf.se>",
"Anton Kochkov <anton.kochkov@gmail.com>",
"Michael Allen <Michael.Allen@benefitfocus.com>",
"JP Verkamp <me@jverkamp.com>",
"Adam Joseph Cook <adam.joseph.cook@gmail.com>",
"Sergey Vidyuk <svidyuk@gmail.com>",
"Radek Liska <radekliska@gmail.com>",
"Jose Molina Colmenero <gaudy41@gmail.com>",
"Max Mikhailov <seven.phases.max@gmail.com>",
"Bryant Williams <b.n.williams@gmail.com>",
"Erik Paluka <erik.paluka@gmail.com>",
"Luke Holder <lukemh@gmail.com>",
"David Mohundro <david@mohundro.com>",
"Nicholas Blumhardt <nblumhardt@nblumhardt.com>",
"Christophe de Dinechin <christophe@taodyne.com>",
"Taneli Vatanen <taneli.vatanen@gmail.com>",
"Jen Evers-Corvina <jen@sevvie.net>",
"Kassio Borges <kassioborgesm@gmail.com>",
"Cedric Sohrauer <sohrauer@googlemail.com>",
"Mickaël Delahaye <mickael.delahaye@gmail.com>",
"Hakan Özler <ozler.hakan@gmail.com>",
"Trey Shugart <treshugart@gmail.com>",
"Vincent Zurczak <vzurczak@linagora.com>",
"Adam Joseph Cook <adam.joseph.cook@gmail.com>",
"Edwin Dalorzo <edwin@dalorzo.org>",
"mucaho <mkucko@gmail.com>",
"Dennis Titze <dennis.titze@gmail.com>",
"Jon Evans <jon@craftyjon.com>",
"Brian Quistorff <bquistorff@gmail.com>",
"Jonathan Suever <suever@gmail.com>",
"Alexis Hénaut <alexis@henaut.net>",
"Chris Kiehl <audionautic@gmail.com>",
"Peter Piwowarski <oldlaptop654@aol.com>",
"Kenta Sato <bicycle1885@gmail.com>",
"Anthony Scemama <scemama@irsamc.ups-tlse.fr>",
"Taufik Nurrohman <latitudu.latitudu@gmail.com>",
"Pedro Oliveira <kanytu@gmail.com>",
"Gu Yiling <justice360@gmail.com>",
"Thomas Applencourt <thomas.applencourt@irsamc.ups-tlse.fr>",
"Andrew Farmer <ahfarmer@gmail.com>",
"Sergey Mashkov <cy6erGn0m@gmail.com>",
"Raivo Laanemets <raivo@infdot.com>",
"Kenneth Fuglsang <kfuglsang@gmail.com>",
"David Anson <david@dlaa.me>",
"Louis Barranqueiro <louis.barranqueiro@gmail.com>",
"Tim Schumacher <tim@datenknoten.me>",
"Lucas Werkmeister <mail@lucaswerkmeister.de>",
"Dan Panzarella <alsoelp@gmail.com>",
"Bruno Dias <bruno.r.dias@gmail.com>",
"Jay Strybis <jay.strybis@gmail.com>",
"Guillaume Gomez <guillaume1.gomez@gmail.com>",
"Janis Voigtländer <janis.voigtlaender@gmail.com>",
"Dirk Kirsten <dk@basex.org>",
"MY Sun <simonmysun@gmail.com>",
"Vadimtro <vadimtro@yahoo.com>",
"Benjamin Auder <benjamin.auder@gmail.com>",
"Dotan Dimet <dotan@corky.net>",
"Manh Tuan <junookyo@gmail.com>",
"Philippe Charrière <ph.charriere@gmail.com>",
"Stefan Bechert <stefan.bechert@gmx.net>",
"Samuel Reed <sam@bitmex.com>",
"Yury Selivanov <yselivanov@gmail.com>",
"Tsuyusato Kitsune <make.just.on@gmail.com>",
"Mick MacCallum <micksmaccallum@gmail.com>",
"Kristoffer Gronlund <kgronlund@suse.com>",
"Søren Enevoldsen <senevoldsen90@gmail.com>",
"Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>",
"Ladislav Prskavec <ladislav@prskavec.net>",
"Jan Kühle <jkuehle90@gmail.com>",
"Stefan Wienert <stwienert@gmail.com>",
"Nikita Savchenko <zitros.lab@gmail.com>",
"Stefania Mellai <s.mellai@arduino.cc>",
"Nebuleon Fumika <nebuleon.fumika@gmail.com>",
"prince <MC.prince.0203@gmail.com>",
"Brendan Rocks <rocks.brendan@gmail.com>",
"Raphaël Assénat <raph@raphnet.net>",
"Matt Evans <matt@aptech.com>",
"Martin Braun <martin.braun@ettus.com>",
"Boris Cherny <boris@performancejs.com>",
"John Foster <jfoster@esri.com>",
"Robert Dodier <robert.dodier@gmail.com>",
"Anthony Dugois <dev.anthonydugois@gmail.com>",
"Qeole <qeole@outlook.com>",
"Denis Ciccale <dciccale@gmail.com>",
"Michael Johnston <lastobelus@gmail.com>",
"Taras <oxdef@oxdef.info>",
"Philipp Wolfer <ph.wolfer@gmail.com>",
"Mikko Kouhia <mikko.kouhia@iki.fi>",
"Billy Quith <chinbillybilbo@gmail.com>",
"Herbert Shin <initbar@protonmail.ch>",
"Tristano Ajmone <tajmone@gmail.com>",
"Taisuke Fujimoto <temp-impl@users.noreply.github.com>",
"Boone Severson <boone.severson@gmail.com>",
"Victor Zhou <OiCMudkips@users.noreply.github.com>",
"Lars Schulna <kartoffelbrei.mit.muskatnuss@gmail.org>",
"Jacob Childress <jacobc@gmail.com>",
"Gavin Siu <gavsiu@gmail.com>",
"Builder's Brewery <buildersbrewery@gmail.com>",
"Sergey Bronnikov <sergeyb@bronevichok.ru>",
"Joe Eli McIlvain <joe.eli.mac@gmail.org>",
"Stephan Boyer <stephan@stephanboyer.com>",
"Alex McKibben <alex@nullscope.net>",
"Daniel Gamage <hellodanielgamage@gmail.com>",
"Matthew Daly <matthewbdaly@gmail.com>",
"Magnus Madsen <mmadsen@uwaterloo.ca>",
"Camil Staps <info@camilstaps.nl>",
"Alexander Lichter <manniL@gmx.net>",
"Nicolas Le Gall <contact@nlegall.fr>",
"Kenton Hamaluik <kentonh@gmail.com>",
"Marvin Saignat <contact@zgmrvn.com>",
"Michael Rodler <contact@f0rki.at>",
"Sergey Sobko <s.sobko@profitware.ru>",
"Hale Chan <halechan@qq.com>",
"Kasper Andersen <kma_untrusted@protonmail.com>",
"Philipp A. <flying-sheep@web.de>",
"Guannan Wei <guannanwei@outlook.com>",
"Sam Wu <samsam2310@gmail.com>",
"Ike Ku <dempfi@yahoo.com>",
"Andres Täht <andres.taht@gmail.com>",
"Rene Saarsoo <nene@triin.net>",
"Jordi Petit <jordi.petit@gmail.com>",
"Raphaël Parrëe <rparree@edc4it.com>",
"Joël Porquet <joel@porquet.org>",
"Alex Arslan <ararslan@comcast.net>",
"Stanislav Belov <stbelov@gmail.com>",
"Ivan Dementev <ivan_div@mail.ru>",
"Nicolas LLOBERA <nllobera@gmail.com>",
"Morten Piibeleht <morten.piibeleht@gmail.com>",
"Martin Clausen <martin.clausene@gmail.com>",
"Arctic Ice Studio <development@arcticicestudio.com>",
"Google Inc. ",
"Ahmad Awais <me@AhmadAwais.com>",
"Duncan Paterson <duncan@exist-db.org>",
"Tristian Kelly <tristian.kelly560@gmail.com>",
"Melissa Geels <melissa@nimble.tools>",
"Dmitriy Tarasov <dimatar@gmail.com>",
"Egor Rogov <e.rogov@postgrespro.ru>",
"Meseta <meseta@gmail.com>",
"Harmon <Harmon.Public@gmail.com>",
"Eric Bailey <eric.w.bailey@gmail.com>",
"Gustavo Costa <gusbemacbe@gmail.com>",
"Jeffrey Arnold <jeffrey.arnold@gmail.com>",
"Antoine Boisier-Michaud <aboisiermichaud@gmail.com>",
"Alejandro Isaza <al@isaza.ca>",
"Laurent Voullemier <laurent.voullemier@gmail.com>",
"Sean T. Allen <sean@monkeysnatchbanana.com>",
"Greg Cline <gregrcline@gmail.com>",
"Sejin Jeon <jinaidy93@gmail.com>",
"Taif Alimov <inzeppelin@gmail.com>",
"Yuri Mazursky <mail@colomolome.com>",
"Carl Baxter <carl@cbax.tech>",
"Thomas Reichel <tom.p.reichel@gmail.com>",
"G8t Guy <g8tguy@g8tguy.com>",
"Samia Ali <samiaab1990@gmail.com>",
"Alexandre Grison <a.grison@gmail.com>",
"Jim Mason <jmason@ibinx.com>",
"lioshi <lioshi@lioshi.com>",
"David Pine <david.pine.7@gmail.com>",
"Konrad Rudolph <konrad.rudolph@gmail.com>",
"Tom Wallace <thomasmichaelwallace@gmail.com>",
"Michael Newton (https://github.com/miken32)",
"Richard Gibson (https://github.com/gibson042)",
"Fredrik Ekre <ekrefredrik@gmail.com>",
"Jan Pilzer (https://github.com/Hirse)",
"Jonathan Sharpe <mail@jonrshar.pe>",
"Michael Rush <michaelrush@gmail.com>",
"Florian Bezdeka <florian@bezdeka.de>",
"Marat Nagayev <nagaevmt@yandex.ru>",
"Patrick Scheibe <patrick@halirutan.de>",
"Kyle Brown (https://github.com/kylebrown9)",
"Marcus Ortiz <mportiz08@gmail.com>",
"Guillaume Grossetie <ggrossetie@yuzutech.fr>",
"Steven Van Impe <steven.vanimpe@icloud.com>",
"Martin Dørum <martid0311@gmail.com>"
],
"bugs": {
"url": "https://github.com/highlightjs/highlight.js/issues"
},
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "git://github.com/highlightjs/highlight.js.git"
},
"main": "./lib/index.js",
"types": "./types/index.d.ts",
"scripts": {
"mocha": "mocha",
"lint": "eslint src/*.js src/lib/*.js src/plugins/*.js demo/*.js",
"lint-languages": "eslint --no-eslintrc -c .eslintrc.lang.js src/languages/**/*.js",
"build_and_test": "npm run build && npm run test",
"build": "node ./tools/build.js -t node",
"build-cdn": "node ./tools/build.js -t cdn",
"build-browser": "node ./tools/build.js -t browser :common",
"test": "mocha test",
"test-markup": "mocha test/markup",
"test-detect": "mocha test/detect",
"test-browser": "mocha test/browser",
"test-parser": "mocha test/parser"
},
"engines": {
"node": "*"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"clean-css": "^4.2.3",
"cli-table": "^0.3.1",
"colors": "^1.1.2",
"commander": "^6.2.0",
"deep-freeze-es6": "^1.4.1",
"del": "^6.0.0",
"dependency-resolver": "^2.0.1",
"eslint": "^7.12.1",
"eslint-config-standard": "^16.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^5.0.0",
"glob": "^7.1.6",
"glob-promise": "^3.4.0",
"handlebars": "^4.7.6",
"js-beautify": "^1.13.0",
"jsdom": "^16.4.0",
"lodash": "^4.17.20",
"mocha": "^8.2.1",
"refa": "^0.4.1",
"rollup": "^2.33.1",
"should": "^13.2.3",
"terser": "^5.3.8",
"tiny-worker": "^2.3.0",
"typescript": "^4.0.5"
}
}

@@ -5,3 +5,3 @@ # Highlight.js

[![beta](https://badgen.net/npm/v/highlight.js/beta)](https://www.npmjs.com/package/highlight.js)
[![slack](https://badgen.net/badge/icon/slack?icon=slack&label&color=pink)](https://join.slack.com/t/highlightjs/shared_invite/zt-jatdlkw4-h3LdjU5rC23t7aQ6zqoxzw)
[![slack](https://badgen.net/badge/icon/slack?icon=slack&label&color=pink)](https://join.slack.com/t/highlightjs/shared_invite/zt-k1f72n07-dUsqwCYtNPz7laRm7mBCTg)
[![license](https://badgen.net/github/license/highlightjs/highlight.js?color=cyan)](https://github.com/highlightjs/highlight.js/blob/master/LICENSE)

@@ -91,10 +91,10 @@ [![install size](https://badgen.net/packagephobia/install/highlight.js?label=npm+install)](https://packagephobia.now.sh/result?p=highlight.js)

## Custom Initialization
## Custom Scenarios
When you need a bit more control over the initialization of
highlight.js, you can use the [`highlightBlock`][3] and [`configure`][4]
functions. This allows you to control *what* to highlight and *when*.
functions. This allows you to better control *what* to highlight and *when*.
Here’s an equivalent way to calling [`initHighlightingOnLoad`][1] using
vanilla JS:
Here’s the equivalent of calling [`initHighlightingOnLoad`][1] using
only vanilla JS:

@@ -109,10 +109,24 @@ ```js

You can use any tags instead of `<pre><code>` to mark up your code. If
you don't use a container that preserves line breaks you will need to
configure highlight.js to use the `<br>` tag:
Please refer to the documentation for [`configure`][4] options.
### Using custom HTML elements for code blocks
We strongly recommend `<pre><code>` wrapping for code blocks. It's quite
semantic and "just works" out of the box with zero fiddling. It is possible to
use other HTML elements (or combos), but you may need to pay special attention to
preserving linebreaks.
Let's say your markup for code blocks uses divs:
```html
<div class='code'>...</div>
```
To highlight such blocks manually:
```js
hljs.configure({useBR: true});
document.querySelectorAll('div.code').forEach((block) => {
// first, find all the div.code blocks
document.querySelectorAll('div.code').forEach(block => {
// then highlight each
hljs.highlightBlock(block);

@@ -122,5 +136,17 @@ });

For other options refer to the documentation for [`configure`][4].
Without using a tag that preserves linebreaks (like `pre`) you'll need some
additional CSS to help preserve them. You could also [pre and post-process line
breaks with a plug-in][brPlugin], but *we recommend using CSS*.
[brPlugin]: https://github.com/highlightjs/highlight.js/issues/2559
To preserve linebreaks inside a `div` using CSS:
```css
div.code {
white-space: pre;
}
```
## Using with Vue.js

@@ -176,3 +202,3 @@

Make sure to use the `.value` property to get the formatted html.
For more info about the returned object refer to the api docs https://highlightjs.readthedocs.io/en/latest/api.html
For more info about the returned object refer to the [api docs](https://highlightjs.readthedocs.io/en/latest/api.html).

@@ -189,3 +215,3 @@

```js
const hljs = require("highlight.js/lib/core"); // require only the core library
const hljs = require('highlight.js/lib/core'); // require only the core library
// separately require languages

@@ -247,3 +273,5 @@ hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));

A prebuilt version of highlight.js bundled with many common languages is hosted by the following CDNs:
A prebuilt version of Highlight.js bundled with many common languages is hosted by several popular CDNs.
When using Highlight.js via CDN you can use Subresource Integrity for additional security. For details
see [DIGESTS.md](https://github.com/highlightjs/cdn-release/blob/master/DIGESTS.md).

@@ -253,8 +281,6 @@ **cdnjs** ([link](https://cdnjs.com/libraries/highlight.js))

```html
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.1/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.1/highlight.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages -->
<script charset="UTF-8"
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.1/languages/go.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/languages/go.min.js"></script>
```

@@ -265,5 +291,6 @@

```html
<link rel="stylesheet"
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.4.1/build/styles/default.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.4.1/build/highlight.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/styles/default.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages -->
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/languages/go.min.js"></script>
```

@@ -274,8 +301,10 @@

```html
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@10.4.1/styles/default.min.css">
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.4.1/highlight.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@10.5.0/styles/default.min.css">
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.5.0/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages -->
<script src="https://unpkg.com/@highlightjs/cdn-assets@10.5.0/languages/go.min.js"></script>
```
**Note:** *The CDN-hosted `highlight.min.js` package doesn't bundle every language.* It would be
very large. You can find our list "common" languages that we bundle by default on our [download page][5].
very large. You can find our list of "common" languages that we bundle by default on our [download page][5].

@@ -282,0 +311,0 @@ ### Self Hosting

@@ -0,1 +1,3 @@

/* eslint-disable no-unused-vars */
/* eslint-disable no-use-before-define */
// For TS consumers who use Node and don't have dom in their tsconfig lib, import the necessary types here.

@@ -66,2 +68,3 @@ /// <reference lib="dom" />

type LanguageFn = (hljs?: HLJSApi) => Language
type CompilerExt = (mode: Mode, parent: Mode | Language | null) => void

@@ -80,2 +83,3 @@ interface HighlightResult {

second_best? : Omit<HighlightResult, 'second_best'>
code?: string
}

@@ -90,10 +94,13 @@ interface AutoHighlightResult extends HighlightResult {}

type PluginEvent =
'before:highlight'
| 'after:highlight'
| 'before:highlightBlock'
| 'after:highlightBlock'
type BeforeHighlightContext = {
code: string,
language: string,
result?: HighlightResult
}
type PluginEvent = keyof HLJSPlugin;
type HLJSPlugin = {
[K in PluginEvent]? : any
'after:highlight'?: (result: HighlightResult) => void,
'before:highlight'?: (context: BeforeHighlightContext) => void,
'after:highlightBlock'?: (data: { result: HighlightResult}) => void,
'before:highlightBlock'?: (data: { block: Element, language: string}) => void,
}

@@ -166,2 +173,4 @@

classNameAliases?: Record<string, string>
compilerExtensions?: CompilerExt[]
supersetOf?: string
}

@@ -185,3 +194,3 @@

data: Record<string, any>
terminator_end: string
terminatorEnd: string
keywordPatternRe: RegExp

@@ -199,2 +208,3 @@ beginRe: RegExp

begin?: RegExp | string
match?: RegExp | string
end?: RegExp | string

@@ -218,5 +228,5 @@ className?: string

relevance?: number
illegal?: string | RegExp
illegal?: string | RegExp | Array<string | RegExp>
variants?: Mode[]
cached_variants?: Mode[]
cachedVariants?: Mode[]
// parsed

@@ -223,0 +233,0 @@ subLanguage?: string | string[]

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc