highlight.js
Advanced tools
Comparing version 8.8.0 to 8.9.0
@@ -653,3 +653,3 @@ /* | ||
function getLanguage(name) { | ||
name = name.toLowerCase(); | ||
name = (name || '').toLowerCase(); | ||
return languages[name] || languages[aliases[name]]; | ||
@@ -697,3 +697,3 @@ } | ||
hljs.PHRASAL_WORDS_MODE = { | ||
begin: /\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/ | ||
begin: /\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/ | ||
}; | ||
@@ -700,0 +700,0 @@ hljs.COMMENT = function (begin, end, inherits) { |
@@ -26,2 +26,3 @@ var hljs = require('./highlight'); | ||
hljs.registerLanguage('cpp', require('./languages/cpp')); | ||
hljs.registerLanguage('crmsh', require('./languages/crmsh')); | ||
hljs.registerLanguage('crystal', require('./languages/crystal')); | ||
@@ -117,2 +118,3 @@ hljs.registerLanguage('cs', require('./languages/cs')); | ||
hljs.registerLanguage('sml', require('./languages/sml')); | ||
hljs.registerLanguage('sqf', require('./languages/sqf')); | ||
hljs.registerLanguage('sql', require('./languages/sql')); | ||
@@ -141,2 +143,2 @@ hljs.registerLanguage('stata', require('./languages/stata')); | ||
module.exports = hljs; | ||
module.exports = hljs; |
@@ -70,2 +70,3 @@ module.exports = function(hljs) { | ||
keywords: { keyword: KEYWORDS, literal: LITERALS }, | ||
illegal: /\/\*/, | ||
contains: [ | ||
@@ -72,0 +73,0 @@ STRING, CHAR_STRING, |
module.exports = function(hljs) { | ||
var NUM_SUFFIX = '(_[uif](8|16|32|64))?'; | ||
var CRYSTAL_IDENT_RE = '[a-zA-Z_]\\w*[!?=]?'; | ||
var RE_STARTER = '!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|' + | ||
'>>|>|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; | ||
var CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?'; | ||
var CRYSTAL_KEYWORDS = { | ||
keyword: | ||
'abstract alias asm begin break case class def do else elsif end ensure enum extend for fun if ifdef ' + | ||
'abstract alias as asm begin break case class def do else elsif end ensure enum extend for fun if ifdef ' + | ||
'include instance_sizeof is_a? lib macro module next of out pointerof private protected rescue responds_to? ' + | ||
'return require self sizeof struct super then type undef union unless until when while with yield ' + | ||
'return require self sizeof struct super then type typeof union unless until when while with yield ' + | ||
'__DIR__ __FILE__ __LINE__', | ||
@@ -15,3 +17,3 @@ literal: 'false nil true' | ||
className: 'subst', | ||
begin: '#\\{', end: '}', | ||
begin: '#{', end: '}', | ||
keywords: CRYSTAL_KEYWORDS | ||
@@ -28,4 +30,10 @@ }; | ||
}; | ||
var | ||
STRING = { | ||
function recursiveParen(begin, end) { | ||
var | ||
contains = [{begin: begin, end: end}]; | ||
contains[0].contains = contains; | ||
return contains; | ||
} | ||
var STRING = { | ||
className: 'string', | ||
@@ -37,6 +45,6 @@ contains: [hljs.BACKSLASH_ESCAPE, SUBST], | ||
{begin: /`/, end: /`/}, | ||
{begin: '%w?\\(', end: '\\)'}, | ||
{begin: '%w?\\[', end: '\\]'}, | ||
{begin: '%w?{', end: '}'}, | ||
{begin: '%w?<', end: '>'}, | ||
{begin: '%w?\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')}, | ||
{begin: '%w?\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')}, | ||
{begin: '%w?{', end: '}', contains: recursiveParen('{', '}')}, | ||
{begin: '%w?<', end: '>', contains: recursiveParen('<', '>')}, | ||
{begin: '%w?/', end: '/'}, | ||
@@ -49,5 +57,49 @@ {begin: '%w?%', end: '%'}, | ||
}; | ||
var REGEXP = { | ||
begin: '(' + RE_STARTER + ')\\s*', | ||
contains: [ | ||
{ | ||
className: 'regexp', | ||
contains: [hljs.BACKSLASH_ESCAPE, SUBST], | ||
variants: [ | ||
{begin: '/', end: '/[a-z]*'}, | ||
{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: '%'}, | ||
{begin: '%r-', end: '-'}, | ||
{begin: '%r\\|', end: '\\|'}, | ||
] | ||
} | ||
], | ||
relevance: 0 | ||
}; | ||
var REGEXP2 = { | ||
className: 'regexp', | ||
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: '%'}, | ||
{begin: '%r-', end: '-'}, | ||
{begin: '%r\\|', end: '\\|'}, | ||
], | ||
relevance: 0 | ||
}; | ||
var ATTRIBUTE = { | ||
className: 'annotation', | ||
begin: '@\\[', end: '\\]', | ||
relevance: 5 | ||
}; | ||
var CRYSTAL_DEFAULT_CONTAINS = [ | ||
EXPANSION, | ||
STRING, | ||
REGEXP, | ||
REGEXP2, | ||
ATTRIBUTE, | ||
hljs.HASH_COMMENT_MODE, | ||
@@ -121,6 +173,6 @@ { | ||
variants: [ | ||
{ begin: '\\b0b([01_]+)' + NUM_SUFFIX }, | ||
{ begin: '\\b0o([0-7_]+)' + NUM_SUFFIX }, | ||
{ begin: '\\b0x([A-Fa-f0-9_]+)' + NUM_SUFFIX }, | ||
{ begin: '\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)' + NUM_SUFFIX} | ||
{ begin: '\\b0b([01_]*[01])' + NUM_SUFFIX }, | ||
{ begin: '\\b0o([0-7_]*[0-7])' + NUM_SUFFIX }, | ||
{ begin: '\\b0x([A-Fa-f0-9_]*[A-Fa-f0-9])' + NUM_SUFFIX }, | ||
{ begin: '\\b(([0-9][0-9_]*[0-9]|[0-9])(\\.[0-9_]*[0-9])?([eE][+-]?[0-9_]*[0-9])?)' + NUM_SUFFIX} | ||
], | ||
@@ -132,19 +184,6 @@ relevance: 0 | ||
begin: '(\\$\\W)|((\\$|\\@\\@?|%)(\\w+))' | ||
}, | ||
{ // regexp container | ||
begin: '(' + hljs.RE_STARTERS_RE + ')\\s*', | ||
contains: [ | ||
hljs.HASH_COMMENT_MODE, | ||
{ | ||
className: 'regexp', | ||
contains: [hljs.BACKSLASH_ESCAPE, SUBST], | ||
variants: [ | ||
{begin: '/', end: '/[a-z]*'}, | ||
] | ||
} | ||
], | ||
relevance: 0 | ||
} | ||
]; | ||
SUBST.contains = CRYSTAL_DEFAULT_CONTAINS; | ||
ATTRIBUTE.contains = CRYSTAL_DEFAULT_CONTAINS; | ||
EXPANSION.contains = CRYSTAL_DEFAULT_CONTAINS.slice(1); // without EXPANSION | ||
@@ -151,0 +190,0 @@ |
@@ -43,3 +43,2 @@ module.exports = function(hljs) { | ||
hljs.C_BLOCK_COMMENT_MODE, | ||
RULE, | ||
{ | ||
@@ -46,0 +45,0 @@ className: 'id', begin: /\#[A-Za-z0-9_-]+/ |
@@ -6,3 +6,3 @@ module.exports = function(hljs) { | ||
keywords: { | ||
built_ins: 'from maintainer cmd expose add copy entrypoint volume user workdir onbuild run env' | ||
built_ins: 'from maintainer cmd expose add copy entrypoint volume user workdir onbuild run env label' | ||
}, | ||
@@ -13,5 +13,5 @@ contains: [ | ||
keywords : { | ||
built_in: 'run cmd entrypoint volume add copy workdir onbuild' | ||
built_in: 'run cmd entrypoint volume add copy workdir onbuild label' | ||
}, | ||
begin: /^ *(onbuild +)?(run|cmd|entrypoint|volume|add|copy|workdir) +/, | ||
begin: /^ *(onbuild +)?(run|cmd|entrypoint|volume|add|copy|workdir|label) +/, | ||
starts: { | ||
@@ -18,0 +18,0 @@ end: /[^\\]\n/, |
@@ -16,2 +16,3 @@ module.exports = function(hljs) { | ||
case_insensitive: true, | ||
illegal: /\/\*/, | ||
keywords: { | ||
@@ -18,0 +19,0 @@ flow: 'if else goto for in do call exit not exist errorlevel defined', |
@@ -52,2 +52,3 @@ module.exports = function(hljs) { | ||
keywords: F_KEYWORDS, | ||
illegal: /\/\*/, | ||
contains: [ | ||
@@ -54,0 +55,0 @@ hljs.inherit(hljs.APOS_STRING_MODE, {className: 'string', relevance: 0}), |
@@ -18,2 +18,3 @@ module.exports = function(hljs) { | ||
'true try type upcast use val void when while with yield', | ||
illegal: /\/\*/, | ||
contains: [ | ||
@@ -20,0 +21,0 @@ { |
@@ -55,3 +55,4 @@ module.exports = function(hljs) { | ||
case_insensitive: true, | ||
keywords: F_KEYWORDS, | ||
keywords: F_KEYWORDS, | ||
illegal: /\/\*/, | ||
contains: [ | ||
@@ -58,0 +59,0 @@ hljs.inherit(hljs.APOS_STRING_MODE, {className: 'string', relevance: 0}), |
@@ -8,3 +8,6 @@ module.exports = function(hljs) { | ||
'instanceof with throw case default try this switch continue typeof delete ' + | ||
'let yield const export super debugger as async await', | ||
'let yield const export super debugger as async await ' + | ||
// ECMAScript 6 modules import | ||
'import from as' | ||
, | ||
literal: | ||
@@ -91,11 +94,2 @@ 'true false null undefined NaN Infinity', | ||
}, | ||
// ECMAScript 6 modules import | ||
{ | ||
beginKeywords: 'import', end: '[;$]', | ||
keywords: 'import from as', | ||
contains: [ | ||
hljs.APOS_STRING_MODE, | ||
hljs.QUOTE_STRING_MODE | ||
] | ||
}, | ||
{ // ES6 class | ||
@@ -109,2 +103,6 @@ className: 'class', | ||
] | ||
}, | ||
{ | ||
beginKeywords: 'constructor', end: /\{/, excludeEnd: true, | ||
relevance: 10 | ||
} | ||
@@ -111,0 +109,0 @@ ], |
@@ -24,2 +24,3 @@ module.exports = function(hljs) { | ||
}, | ||
illegal: /\/\*/, | ||
contains: [ | ||
@@ -26,0 +27,0 @@ hljs.COMMENT('#rem', '#end'), |
@@ -166,4 +166,5 @@ module.exports = function(hljs) { | ||
keywords: RUBY_KEYWORDS, | ||
illegal: /\/\*/, | ||
contains: COMMENT_MODES.concat(IRB_DEFAULT).concat(RUBY_DEFAULT_CONTAINS) | ||
}; | ||
}; |
@@ -33,4 +33,17 @@ module.exports = function(hljs) { | ||
beginKeywords: 'class object trait type', | ||
end: /[:={\[(\n;]/, | ||
contains: [{className: 'keyword', beginKeywords: 'extends with', relevance: 10}, NAME] | ||
end: /[:={\[\n;]/, | ||
excludeEnd: true, | ||
contains: [ | ||
{ | ||
beginKeywords: 'extends with', | ||
relevance: 10 | ||
}, | ||
{ | ||
'className': 'params', | ||
'begin': /\(/, | ||
'end': /\)/, | ||
relevance: 0 | ||
}, | ||
NAME | ||
] | ||
}; | ||
@@ -40,3 +53,3 @@ | ||
className: 'function', | ||
beginKeywords: 'def val', | ||
beginKeywords: 'def', | ||
end: /[:={\[(\n;]/, | ||
@@ -43,0 +56,0 @@ contains: [NAME] |
module.exports = function(hljs) { | ||
var SWIFT_KEYWORDS = { | ||
keyword: 'class deinit enum extension func init let protocol static ' + | ||
'struct subscript typealias var break case continue default do ' + | ||
'else fallthrough if in for return switch where while as dynamicType ' + | ||
'is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ ' + | ||
'__LINE__ associativity didSet get infix inout left mutating none ' + | ||
'nonmutating operator override postfix precedence prefix right set '+ | ||
'unowned unowned safe unsafe weak willSet', | ||
keyword: '__COLUMN__ __FILE__ __FUNCTION__ __LINE__ as as! as? associativity ' + | ||
'break case catch class continue convenience default defer deinit didSet do ' + | ||
'dynamic dynamicType else enum extension fallthrough false final for func ' + | ||
'get guard if import in indirect infix init inout internal is lazy left let ' + | ||
'mutating nil none nonmutating operator optional override postfix precedence ' + | ||
'prefix private protocol Protocol public repeat required rethrows return ' + | ||
'right self Self set 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 assert bridgeFromObjectiveC ' + | ||
'bridgeFromObjectiveCUnconditional bridgeToObjectiveC ' + | ||
'bridgeToObjectiveCUnconditional c contains count countElements ' + | ||
'countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump ' + | ||
'encodeBitsAsWords enumerate equal filter find getBridgedObjectiveCType ' + | ||
'getVaList indices insertionSort isBridgedToObjectiveC ' + | ||
'isBridgedVerbatimToObjectiveC isUniquelyReferenced join ' + | ||
'lexicographicalCompare map max maxElement min minElement numericCast ' + | ||
'partition posix print println quickSort reduce reflect reinterpretCast ' + | ||
'reverse roundUpToAlignment sizeof sizeofValue sort split startsWith strideof ' + | ||
'strideofValue swap swift toString transcode underestimateCount ' + | ||
built_in: 'abs advance alignof alignofValue anyGenerator assert assertionFailure ' + | ||
'bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC ' + | ||
'bridgeToObjectiveCUnconditional c 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 withUnsafePointers withVaList' | ||
'withUnsafePointerToObject withUnsafeMutablePointer withUnsafeMutablePointers ' + | ||
'withUnsafePointer withUnsafePointers withVaList zip' | ||
}; | ||
@@ -103,6 +106,8 @@ | ||
className: 'preprocessor', // @attributes | ||
begin: '(@assignment|@class_protocol|@exported|@final|@lazy|@noreturn|' + | ||
'@NSCopying|@NSManaged|@objc|@optional|@required|@auto_closure|' + | ||
begin: '(@warn_unused_result|@exported|@lazy|@noescape|' + | ||
'@NSCopying|@NSManaged|@objc|@convention|@required|' + | ||
'@noreturn|@IBAction|@IBDesignable|@IBInspectable|@IBOutlet|' + | ||
'@infix|@prefix|@postfix)' | ||
'@infix|@prefix|@postfix|@autoclosure|@testable|@available|' + | ||
'@nonobjc|@NSApplicationMain|@UIApplicationMain)' | ||
}, | ||
@@ -109,0 +114,0 @@ { |
@@ -6,4 +6,4 @@ module.exports = function(hljs) { | ||
'instanceof with throw case default try this switch continue typeof delete ' + | ||
'let yield const class public private get set super ' + | ||
'static implements enum export import declare type protected', | ||
'let yield const class public private protected get set super ' + | ||
'static implements enum export import declare type namespace abstract', | ||
literal: | ||
@@ -32,2 +32,13 @@ 'true false null undefined NaN Infinity', | ||
hljs.QUOTE_STRING_MODE, | ||
{ // template string | ||
className: 'string', | ||
begin: '`', end: '`', | ||
contains: [ | ||
hljs.BACKSLASH_ESCAPE, | ||
{ | ||
className: 'subst', | ||
begin: '\\$\\{', end: '\\}' | ||
} | ||
] | ||
}, | ||
hljs.C_LINE_COMMENT_MODE, | ||
@@ -78,3 +89,2 @@ hljs.C_BLOCK_COMMENT_MODE, | ||
{ | ||
className: 'constructor', | ||
beginKeywords: 'constructor', end: /\{/, excludeEnd: true, | ||
@@ -81,0 +91,0 @@ relevance: 10 |
@@ -9,3 +9,3 @@ { | ||
"homepage": "https://highlightjs.org/", | ||
"version": "8.8.0", | ||
"version": "8.9.0", | ||
"author": { | ||
@@ -727,2 +727,22 @@ "name": "Ivan Sagalaev", | ||
"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" | ||
} | ||
@@ -729,0 +749,0 @@ ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
901095
222
20112