调整分包,完成隐私协议(样式待优化)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
const config = require('../../config'),
|
||||
hljs = require('./highlight');
|
||||
// config.highlight.forEach(item => {
|
||||
// hljs.registerLanguage(item, require(`./languages/${item}`).default);
|
||||
// });
|
||||
hljs.registerLanguage('c-like', require('./languages/c-like').default);hljs.registerLanguage('c', require('./languages/c').default);hljs.registerLanguage('bash', require('./languages/bash').default);hljs.registerLanguage('css', require('./languages/css').default);hljs.registerLanguage('dart', require('./languages/dart').default);hljs.registerLanguage('go', require('./languages/go').default);hljs.registerLanguage('java', require('./languages/java').default);hljs.registerLanguage('javascript', require('./languages/javascript').default);hljs.registerLanguage('json', require('./languages/json').default);hljs.registerLanguage('less', require('./languages/less').default);hljs.registerLanguage('scss', require('./languages/scss').default);hljs.registerLanguage('shell', require('./languages/shell').default);hljs.registerLanguage('xml', require('./languages/xml').default);hljs.registerLanguage('htmlbars', require('./languages/htmlbars').default);hljs.registerLanguage('nginx', require('./languages/nginx').default);hljs.registerLanguage('php', require('./languages/php').default);hljs.registerLanguage('python', require('./languages/python').default);hljs.registerLanguage('python-repl', require('./languages/python-repl').default);hljs.registerLanguage('typescript', require('./languages/typescript').default);
|
||||
|
||||
module.exports = hljs;
|
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
Language: Bash
|
||||
Author: vah <vahtenberg@gmail.com>
|
||||
Contributrors: Benjamin Pannell <contact@sierrasoftworks.com>
|
||||
Website: https://www.gnu.org/software/bash/
|
||||
Category: common
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
const VAR = {};
|
||||
const BRACED_VAR = {
|
||||
begin: /\$\{/, end:/\}/,
|
||||
contains: [
|
||||
{ begin: /:-/, contains: [VAR] } // default values
|
||||
]
|
||||
};
|
||||
Object.assign(VAR,{
|
||||
className: 'variable',
|
||||
variants: [
|
||||
{begin: /\$[\w\d#@][\w\d_]*/},
|
||||
BRACED_VAR
|
||||
]
|
||||
});
|
||||
|
||||
const SUBST = {
|
||||
className: 'subst',
|
||||
begin: /\$\(/, end: /\)/,
|
||||
contains: [hljs.BACKSLASH_ESCAPE]
|
||||
};
|
||||
const QUOTE_STRING = {
|
||||
className: 'string',
|
||||
begin: /"/, end: /"/,
|
||||
contains: [
|
||||
hljs.BACKSLASH_ESCAPE,
|
||||
VAR,
|
||||
SUBST
|
||||
]
|
||||
};
|
||||
SUBST.contains.push(QUOTE_STRING);
|
||||
const ESCAPED_QUOTE = {
|
||||
className: '',
|
||||
begin: /\\"/
|
||||
|
||||
};
|
||||
const APOS_STRING = {
|
||||
className: 'string',
|
||||
begin: /'/, end: /'/
|
||||
};
|
||||
const ARITHMETIC = {
|
||||
begin: /\$\(\(/,
|
||||
end: /\)\)/,
|
||||
contains: [
|
||||
{ begin: /\d+#[0-9a-f]+/, className: "number" },
|
||||
hljs.NUMBER_MODE,
|
||||
VAR
|
||||
]
|
||||
};
|
||||
const SHEBANG = {
|
||||
className: 'meta',
|
||||
begin: /^#![^\n]+sh\s*$/,
|
||||
relevance: 10
|
||||
};
|
||||
const FUNCTION = {
|
||||
className: 'function',
|
||||
begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/,
|
||||
returnBegin: true,
|
||||
contains: [hljs.inherit(hljs.TITLE_MODE, {begin: /\w[\w\d_]*/})],
|
||||
relevance: 0
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'Bash',
|
||||
aliases: ['sh', 'zsh'],
|
||||
lexemes: /\b-?[a-z\._]+\b/,
|
||||
keywords: {
|
||||
keyword:
|
||||
'if then else elif fi for while in do done case esac function',
|
||||
literal:
|
||||
'true false',
|
||||
built_in:
|
||||
// Shell built-ins
|
||||
// http://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
||||
'break cd continue eval exec exit export getopts hash pwd readonly return shift test times ' +
|
||||
'trap umask unset ' +
|
||||
// Bash built-ins
|
||||
'alias bind builtin caller command declare echo enable help let local logout mapfile printf ' +
|
||||
'read readarray source type typeset ulimit unalias ' +
|
||||
// Shell modifiers
|
||||
'set shopt ' +
|
||||
// Zsh built-ins
|
||||
'autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles ' +
|
||||
'compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate ' +
|
||||
'fc fg float functions getcap getln history integer jobs kill limit log noglob popd print ' +
|
||||
'pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit ' +
|
||||
'unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof ' +
|
||||
'zpty zregexparse zsocket zstyle ztcp',
|
||||
_:
|
||||
'-ne -eq -lt -gt -f -d -e -s -l -a' // relevance booster
|
||||
},
|
||||
contains: [
|
||||
SHEBANG,
|
||||
FUNCTION,
|
||||
ARITHMETIC,
|
||||
hljs.HASH_COMMENT_MODE,
|
||||
QUOTE_STRING,
|
||||
ESCAPED_QUOTE,
|
||||
APOS_STRING,
|
||||
VAR
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
Language: C-like foundation grammar for C/C++ grammars
|
||||
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
Contributors: Evgeny Stepanischev <imbolk@gmail.com>, Zaven Muradyan <megalivoithos@gmail.com>, Roel Deckers <admin@codingcat.nl>, Sam Wu <samsam2310@gmail.com>, Jordi Petit <jordi.petit@gmail.com>, Pieter Vantorre <pietervantorre@gmail.com>, Google Inc. (David Benjamin) <davidben@google.com>
|
||||
Category: common, system
|
||||
*/
|
||||
|
||||
/* In the future the intention is to split out the C/C++ grammars distinctly
|
||||
since they are separate languages. They will likely share a common foundation
|
||||
though, and this file sets the groundwork for that - so that we get the breaking
|
||||
change in v10 and don't have to change the requirements again later.
|
||||
|
||||
See: https://github.com/highlightjs/highlight.js/issues/2146
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
function optional(s) {
|
||||
return '(?:' + s + ')?';
|
||||
}
|
||||
var DECLTYPE_AUTO_RE = 'decltype\\(auto\\)'
|
||||
var NAMESPACE_RE = '[a-zA-Z_]\\w*::'
|
||||
var TEMPLATE_ARGUMENT_RE = '<.*?>';
|
||||
var FUNCTION_TYPE_RE = '(' +
|
||||
DECLTYPE_AUTO_RE + '|' +
|
||||
optional(NAMESPACE_RE) +'[a-zA-Z_]\\w*' + optional(TEMPLATE_ARGUMENT_RE) +
|
||||
')';
|
||||
var CPP_PRIMITIVE_TYPES = {
|
||||
className: 'keyword',
|
||||
begin: '\\b[a-z\\d_]*_t\\b'
|
||||
};
|
||||
|
||||
// https://en.cppreference.com/w/cpp/language/escape
|
||||
// \\ \x \xFF \u2837 \u00323747 \374
|
||||
var CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)'
|
||||
var STRINGS = {
|
||||
className: 'string',
|
||||
variants: [
|
||||
{
|
||||
begin: '(u8?|U|L)?"', end: '"',
|
||||
illegal: '\\n',
|
||||
contains: [hljs.BACKSLASH_ESCAPE]
|
||||
},
|
||||
{
|
||||
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + "|.)", end: '\'',
|
||||
illegal: '.'
|
||||
},
|
||||
{ begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\((?:.|\n)*?\)\1"/ }
|
||||
]
|
||||
};
|
||||
|
||||
var NUMBERS = {
|
||||
className: 'number',
|
||||
variants: [
|
||||
{ begin: '\\b(0b[01\']+)' },
|
||||
{ begin: '(-?)\\b([\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)(u|U|l|L|ul|UL|f|F|b|B)' },
|
||||
{ begin: '(-?)(\\b0[xX][a-fA-F0-9\']+|(\\b[\\d\']+(\\.[\\d\']*)?|\\.[\\d\']+)([eE][-+]?[\\d\']+)?)' }
|
||||
],
|
||||
relevance: 0
|
||||
};
|
||||
|
||||
var PREPROCESSOR = {
|
||||
className: 'meta',
|
||||
begin: /#\s*[a-z]+\b/, end: /$/,
|
||||
keywords: {
|
||||
'meta-keyword':
|
||||
'if else elif endif define undef warning error line ' +
|
||||
'pragma _Pragma ifdef ifndef include'
|
||||
},
|
||||
contains: [
|
||||
{
|
||||
begin: /\\\n/, relevance: 0
|
||||
},
|
||||
hljs.inherit(STRINGS, {className: 'meta-string'}),
|
||||
{
|
||||
className: 'meta-string',
|
||||
begin: /<.*?>/, end: /$/,
|
||||
illegal: '\\n',
|
||||
},
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE
|
||||
]
|
||||
};
|
||||
|
||||
var TITLE_MODE = {
|
||||
className: 'title',
|
||||
begin: optional(NAMESPACE_RE) + hljs.IDENT_RE,
|
||||
relevance: 0
|
||||
};
|
||||
|
||||
var FUNCTION_TITLE = optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\(';
|
||||
|
||||
var CPP_KEYWORDS = {
|
||||
keyword: 'int float while private char char8_t char16_t char32_t catch import module export virtual operator sizeof ' +
|
||||
'dynamic_cast|10 typedef const_cast|10 const for static_cast|10 union namespace ' +
|
||||
'unsigned long volatile static protected bool template mutable if public friend ' +
|
||||
'do goto auto void enum else break extern using asm case typeid wchar_t ' +
|
||||
'short reinterpret_cast|10 default double register explicit signed typename try this ' +
|
||||
'switch continue inline delete alignas alignof constexpr consteval constinit decltype ' +
|
||||
'concept co_await co_return co_yield requires ' +
|
||||
'noexcept static_assert thread_local restrict final override ' +
|
||||
'atomic_bool atomic_char atomic_schar ' +
|
||||
'atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong ' +
|
||||
'atomic_ullong new throw return ' +
|
||||
'and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq',
|
||||
built_in: 'std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' +
|
||||
'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' +
|
||||
'unordered_map unordered_multiset unordered_multimap array shared_ptr abort terminate abs acos ' +
|
||||
'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +
|
||||
'fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +
|
||||
'isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow ' +
|
||||
'printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp ' +
|
||||
'strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan ' +
|
||||
'vfprintf vprintf vsprintf endl initializer_list unique_ptr _Bool complex _Complex imaginary _Imaginary',
|
||||
literal: 'true false nullptr NULL'
|
||||
};
|
||||
|
||||
var EXPRESSION_CONTAINS = [
|
||||
CPP_PRIMITIVE_TYPES,
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
NUMBERS,
|
||||
STRINGS
|
||||
];
|
||||
|
||||
var EXPRESSION_CONTEXT = {
|
||||
// This mode covers expression context where we can't expect a function
|
||||
// definition and shouldn't highlight anything that looks like one:
|
||||
// `return some()`, `else if()`, `(x*sum(1, 2))`
|
||||
variants: [
|
||||
{begin: /=/, end: /;/},
|
||||
{begin: /\(/, end: /\)/},
|
||||
{beginKeywords: 'new throw return else', end: /;/}
|
||||
],
|
||||
keywords: CPP_KEYWORDS,
|
||||
contains: EXPRESSION_CONTAINS.concat([
|
||||
{
|
||||
begin: /\(/, end: /\)/,
|
||||
keywords: CPP_KEYWORDS,
|
||||
contains: EXPRESSION_CONTAINS.concat(['self']),
|
||||
relevance: 0
|
||||
}
|
||||
]),
|
||||
relevance: 0
|
||||
};
|
||||
|
||||
var FUNCTION_DECLARATION = {
|
||||
className: 'function',
|
||||
begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE,
|
||||
returnBegin: true, end: /[{;=]/,
|
||||
excludeEnd: true,
|
||||
keywords: CPP_KEYWORDS,
|
||||
illegal: /[^\w\s\*&:<>]/,
|
||||
contains: [
|
||||
|
||||
{ // to prevent it from being confused as the function title
|
||||
begin: DECLTYPE_AUTO_RE,
|
||||
keywords: CPP_KEYWORDS,
|
||||
relevance: 0,
|
||||
},
|
||||
{
|
||||
begin: FUNCTION_TITLE, returnBegin: true,
|
||||
contains: [TITLE_MODE],
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
className: 'params',
|
||||
begin: /\(/, end: /\)/,
|
||||
keywords: CPP_KEYWORDS,
|
||||
relevance: 0,
|
||||
contains: [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
STRINGS,
|
||||
NUMBERS,
|
||||
CPP_PRIMITIVE_TYPES,
|
||||
// Count matching parentheses.
|
||||
{
|
||||
begin: /\(/, end: /\)/,
|
||||
keywords: CPP_KEYWORDS,
|
||||
relevance: 0,
|
||||
contains: [
|
||||
'self',
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
STRINGS,
|
||||
NUMBERS,
|
||||
CPP_PRIMITIVE_TYPES
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
CPP_PRIMITIVE_TYPES,
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
PREPROCESSOR
|
||||
]
|
||||
};
|
||||
|
||||
return {
|
||||
aliases: ['c', 'cc', 'h', 'c++', 'h++', 'hpp', 'hh', 'hxx', 'cxx'],
|
||||
keywords: CPP_KEYWORDS,
|
||||
// the base c-like language will NEVER be auto-detected, rather the
|
||||
// derivitives: c, c++, arduino turn auto-detect back on for themselves
|
||||
disableAutodetect: true,
|
||||
illegal: '</',
|
||||
contains: [].concat(
|
||||
EXPRESSION_CONTEXT,
|
||||
FUNCTION_DECLARATION,
|
||||
EXPRESSION_CONTAINS,
|
||||
[
|
||||
PREPROCESSOR,
|
||||
{
|
||||
begin: '\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>',
|
||||
keywords: CPP_KEYWORDS,
|
||||
contains: ['self', CPP_PRIMITIVE_TYPES]
|
||||
},
|
||||
{
|
||||
begin: hljs.IDENT_RE + '::',
|
||||
keywords: CPP_KEYWORDS
|
||||
},
|
||||
{
|
||||
className: 'class',
|
||||
beginKeywords: 'class struct', end: /[{;:]/,
|
||||
contains: [
|
||||
{begin: /</, end: />/, contains: ['self']}, // skip generic stuff
|
||||
hljs.TITLE_MODE
|
||||
]
|
||||
}
|
||||
]),
|
||||
exports: {
|
||||
preprocessor: PREPROCESSOR,
|
||||
strings: STRINGS,
|
||||
keywords: CPP_KEYWORDS
|
||||
}
|
||||
};
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Language: C
|
||||
Category: common, system
|
||||
Website: https://en.wikipedia.org/wiki/C_(programming_language)
|
||||
Requires: c-like.js
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
|
||||
var lang = hljs.getLanguage('c-like').rawDefinition();
|
||||
// Until C is actually different than C++ there is no reason to auto-detect C
|
||||
// as it's own language since it would just fail auto-detect testing or
|
||||
// simply match with C++.
|
||||
//
|
||||
// See further comments in c-like.js.
|
||||
|
||||
// lang.disableAutodetect = false;
|
||||
lang.name = 'C';
|
||||
lang.aliases = ['c', 'h'];
|
||||
return lang;
|
||||
|
||||
}
|
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
Language: CSS
|
||||
Category: common, css
|
||||
Website: https://developer.mozilla.org/en-US/docs/Web/CSS
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var FUNCTION_LIKE = {
|
||||
begin: /[\w-]+\(/, returnBegin: true,
|
||||
contains: [
|
||||
{
|
||||
className: 'built_in',
|
||||
begin: /[\w-]+/
|
||||
},
|
||||
{
|
||||
begin: /\(/, end: /\)/,
|
||||
contains: [
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.CSS_NUMBER_MODE,
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
var ATTRIBUTE = {
|
||||
className: 'attribute',
|
||||
begin: /\S/, end: ':', excludeEnd: true,
|
||||
starts: {
|
||||
endsWithParent: true, excludeEnd: true,
|
||||
contains: [
|
||||
FUNCTION_LIKE,
|
||||
hljs.CSS_NUMBER_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
{
|
||||
className: 'number', begin: '#[0-9A-Fa-f]+'
|
||||
},
|
||||
{
|
||||
className: 'meta', begin: '!important'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
var AT_IDENTIFIER = '@[a-z-]+' // @font-face
|
||||
var AT_MODIFIERS = "and or not only"
|
||||
var MEDIA_TYPES = "all print screen speech"
|
||||
var AT_PROPERTY_RE = /@\-?\w[\w]*(\-\w+)*/ // @-webkit-keyframes
|
||||
var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*';
|
||||
var RULE = {
|
||||
begin: /(?:[A-Z\_\.\-]+|--[a-zA-Z0-9_-]+)\s*:/, returnBegin: true, end: ';', endsWithParent: true,
|
||||
contains: [
|
||||
ATTRIBUTE
|
||||
]
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'CSS',
|
||||
case_insensitive: true,
|
||||
illegal: /[=\/|'\$]/,
|
||||
contains: [
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
{
|
||||
className: 'selector-id', begin: /#[A-Za-z0-9_-]+/
|
||||
},
|
||||
{
|
||||
className: 'selector-class', begin: /\.[A-Za-z0-9_-]+/
|
||||
},
|
||||
{
|
||||
className: 'selector-attr',
|
||||
begin: /\[/, end: /\]/,
|
||||
illegal: '$',
|
||||
contains: [
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
]
|
||||
},
|
||||
{
|
||||
className: 'selector-pseudo',
|
||||
begin: /:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/
|
||||
},
|
||||
// matching these here allows us to treat them more like regular CSS
|
||||
// rules so everything between the {} gets regular rule highlighting,
|
||||
// which is what we want for page and font-face
|
||||
{
|
||||
begin: '@(page|font-face)',
|
||||
lexemes: AT_IDENTIFIER,
|
||||
keywords: '@page @font-face'
|
||||
},
|
||||
{
|
||||
begin: '@', end: '[{;]', // at_rule eating first "{" is a good thing
|
||||
// because it doesn’t let it to be parsed as
|
||||
// a rule set but instead drops parser into
|
||||
// the default mode which is how it should be.
|
||||
illegal: /:/, // break on Less variables @var: ...
|
||||
returnBegin: true,
|
||||
contains: [
|
||||
{
|
||||
className: 'keyword',
|
||||
begin: AT_PROPERTY_RE
|
||||
},
|
||||
{
|
||||
begin: /\s/, endsWithParent: true, excludeEnd: true,
|
||||
relevance: 0,
|
||||
keywords: AT_MODIFIERS,
|
||||
contains: [
|
||||
{
|
||||
begin: /[a-z-]+:/,
|
||||
className:"attribute"
|
||||
},
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.CSS_NUMBER_MODE
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
className: 'selector-tag', begin: IDENT_RE,
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
begin: '{', end: '}',
|
||||
illegal: /\S/,
|
||||
contains: [
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
RULE,
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
Language: Dart
|
||||
Requires: markdown.js
|
||||
Author: Maxim Dikun <dikmax@gmail.com>
|
||||
Description: Dart a modern, object-oriented language developed by Google. For more information see https://www.dartlang.org/
|
||||
Website: https://dart.dev
|
||||
Category: scripting
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var SUBST = {
|
||||
className: 'subst',
|
||||
variants: [{
|
||||
begin: '\\$[A-Za-z0-9_]+'
|
||||
}],
|
||||
};
|
||||
|
||||
var BRACED_SUBST = {
|
||||
className: 'subst',
|
||||
variants: [{
|
||||
begin: '\\${',
|
||||
end: '}'
|
||||
}, ],
|
||||
keywords: 'true false null this is new super',
|
||||
};
|
||||
|
||||
var STRING = {
|
||||
className: 'string',
|
||||
variants: [{
|
||||
begin: 'r\'\'\'',
|
||||
end: '\'\'\''
|
||||
},
|
||||
{
|
||||
begin: 'r"""',
|
||||
end: '"""'
|
||||
},
|
||||
{
|
||||
begin: 'r\'',
|
||||
end: '\'',
|
||||
illegal: '\\n'
|
||||
},
|
||||
{
|
||||
begin: 'r"',
|
||||
end: '"',
|
||||
illegal: '\\n'
|
||||
},
|
||||
{
|
||||
begin: '\'\'\'',
|
||||
end: '\'\'\'',
|
||||
contains: [hljs.BACKSLASH_ESCAPE, SUBST, BRACED_SUBST]
|
||||
},
|
||||
{
|
||||
begin: '"""',
|
||||
end: '"""',
|
||||
contains: [hljs.BACKSLASH_ESCAPE, SUBST, BRACED_SUBST]
|
||||
},
|
||||
{
|
||||
begin: '\'',
|
||||
end: '\'',
|
||||
illegal: '\\n',
|
||||
contains: [hljs.BACKSLASH_ESCAPE, SUBST, BRACED_SUBST]
|
||||
},
|
||||
{
|
||||
begin: '"',
|
||||
end: '"',
|
||||
illegal: '\\n',
|
||||
contains: [hljs.BACKSLASH_ESCAPE, SUBST, BRACED_SUBST]
|
||||
}
|
||||
]
|
||||
};
|
||||
BRACED_SUBST.contains = [
|
||||
hljs.C_NUMBER_MODE, STRING
|
||||
];
|
||||
|
||||
var KEYWORDS = {
|
||||
keyword: 'abstract as assert async await break case catch class const continue covariant default deferred do ' +
|
||||
'dynamic else enum export extends extension external factory false final finally for Function get hide if ' +
|
||||
'implements import in inferface is library mixin new null on operator part rethrow return set show static ' +
|
||||
'super switch sync this throw true try typedef var void while with yield',
|
||||
built_in:
|
||||
// dart:core
|
||||
'Comparable DateTime Duration Function Iterable Iterator List Map Match Null Object Pattern RegExp Set ' +
|
||||
'Stopwatch String StringBuffer StringSink Symbol Type Uri bool double dynamic int num print ' +
|
||||
// dart:html
|
||||
'Element ElementList document querySelector querySelectorAll window'
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'Dart',
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
STRING,
|
||||
hljs.COMMENT(
|
||||
'/\\*\\*',
|
||||
'\\*/', {
|
||||
subLanguage: 'markdown',
|
||||
relevance:0
|
||||
}
|
||||
),
|
||||
hljs.COMMENT(
|
||||
'///+\\s*',
|
||||
'$', {
|
||||
contains: [{
|
||||
subLanguage: 'markdown',
|
||||
begin: '.',
|
||||
end: '$',
|
||||
relevance:0
|
||||
}]
|
||||
}
|
||||
),
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
{
|
||||
className: 'class',
|
||||
beginKeywords: 'class interface',
|
||||
end: '{',
|
||||
excludeEnd: true,
|
||||
contains: [{
|
||||
beginKeywords: 'extends implements'
|
||||
},
|
||||
hljs.UNDERSCORE_TITLE_MODE
|
||||
]
|
||||
},
|
||||
hljs.C_NUMBER_MODE,
|
||||
{
|
||||
className: 'meta',
|
||||
begin: '@[A-Za-z]+'
|
||||
},
|
||||
{
|
||||
begin: '=>' // No markup, just a relevance booster
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Language: Go
|
||||
Author: Stephan Kountso aka StepLg <steplg@gmail.com>
|
||||
Contributors: Evgeny Stepanischev <imbolk@gmail.com>
|
||||
Description: Google go language (golang). For info about language
|
||||
Website: http://golang.org/
|
||||
Category: common, system
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var GO_KEYWORDS = {
|
||||
keyword:
|
||||
'break default func interface select case map struct chan else goto package switch ' +
|
||||
'const fallthrough if range type continue for import return var go defer ' +
|
||||
'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' +
|
||||
'uint16 uint32 uint64 int uint uintptr rune',
|
||||
literal:
|
||||
'true false iota nil',
|
||||
built_in:
|
||||
'append cap close complex copy imag len make new panic print println real recover delete'
|
||||
};
|
||||
return {
|
||||
name: 'Go',
|
||||
aliases: ['golang'],
|
||||
keywords: GO_KEYWORDS,
|
||||
illegal: '</',
|
||||
contains: [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
{
|
||||
className: 'string',
|
||||
variants: [
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.APOS_STRING_MODE,
|
||||
{begin: '`', end: '`'},
|
||||
]
|
||||
},
|
||||
{
|
||||
className: 'number',
|
||||
variants: [
|
||||
{begin: hljs.C_NUMBER_RE + '[i]', relevance: 1},
|
||||
hljs.C_NUMBER_MODE
|
||||
]
|
||||
},
|
||||
{
|
||||
begin: /:=/ // relevance booster
|
||||
},
|
||||
{
|
||||
className: 'function',
|
||||
beginKeywords: 'func', end: '\\s*(\\{|$)', excludeEnd: true,
|
||||
contains: [
|
||||
hljs.TITLE_MODE,
|
||||
{
|
||||
className: 'params',
|
||||
begin: /\(/, end: /\)/,
|
||||
keywords: GO_KEYWORDS,
|
||||
illegal: /["']/
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Language: HTMLBars
|
||||
Requires: xml.js
|
||||
Author: Michael Johnston <lastobelus@gmail.com>
|
||||
Description: Matcher for HTMLBars
|
||||
Website: https://github.com/tildeio/htmlbars
|
||||
Category: template
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var BUILT_INS = 'action collection component concat debugger each each-in else get hash if input link-to loc log mut outlet partial query-params render textarea unbound unless with yield view';
|
||||
|
||||
var ATTR_ASSIGNMENT = {
|
||||
illegal: /\}\}/,
|
||||
begin: /[a-zA-Z0-9_]+=/,
|
||||
returnBegin: true,
|
||||
relevance: 0,
|
||||
contains: [
|
||||
{
|
||||
className: 'attr', begin: /[a-zA-Z0-9_]+/
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var SUB_EXPR = {
|
||||
illegal: /\}\}/,
|
||||
begin: /\)/, end: /\)/,
|
||||
contains: [
|
||||
{
|
||||
begin: /[a-zA-Z\.\-]+/,
|
||||
keywords: {built_in: BUILT_INS},
|
||||
starts: {
|
||||
endsWithParent: true, relevance: 0,
|
||||
contains: [
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var TAG_INNARDS = {
|
||||
endsWithParent: true, relevance: 0,
|
||||
keywords: {keyword: 'as', built_in: BUILT_INS},
|
||||
contains: [
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
ATTR_ASSIGNMENT,
|
||||
hljs.NUMBER_MODE
|
||||
]
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'HTMLBars',
|
||||
case_insensitive: true,
|
||||
subLanguage: 'xml',
|
||||
contains: [
|
||||
hljs.COMMENT('{{!(--)?', '(--)?}}'),
|
||||
{
|
||||
className: 'template-tag',
|
||||
begin: /\{\{[#\/]/, end: /\}\}/,
|
||||
contains: [
|
||||
{
|
||||
className: 'name',
|
||||
begin: /[a-zA-Z\.\-]+/,
|
||||
keywords: {'builtin-name': BUILT_INS},
|
||||
starts: TAG_INNARDS
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
className: 'template-variable',
|
||||
begin: /\{\{[a-zA-Z][a-zA-Z\-]+/, end: /\}\}/,
|
||||
keywords: {keyword: 'as', built_in: BUILT_INS},
|
||||
contains: [
|
||||
hljs.QUOTE_STRING_MODE
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
Language: Java
|
||||
Author: Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
|
||||
Category: common, enterprise
|
||||
Website: https://www.java.com/
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var JAVA_IDENT_RE = '[\u00C0-\u02B8a-zA-Z_$][\u00C0-\u02B8a-zA-Z_$0-9]*';
|
||||
var GENERIC_IDENT_RE = JAVA_IDENT_RE + '(<' + JAVA_IDENT_RE + '(\\s*,\\s*' + JAVA_IDENT_RE + ')*>)?';
|
||||
var KEYWORDS =
|
||||
'false synchronized int abstract float private char boolean var static null if const ' +
|
||||
'for true while long strictfp finally protected import native final void ' +
|
||||
'enum else break transient catch instanceof byte super volatile case assert short ' +
|
||||
'package default double public try this switch continue throws protected public private ' +
|
||||
'module requires exports do';
|
||||
|
||||
var ANNOTATION = {
|
||||
className: 'meta',
|
||||
begin: '@' + JAVA_IDENT_RE,
|
||||
contains:[
|
||||
{
|
||||
begin: /\(/,
|
||||
end: /\)/,
|
||||
contains: ["self"] // allow nested () inside our annotation
|
||||
},
|
||||
]
|
||||
}
|
||||
// https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html
|
||||
var JAVA_NUMBER_RE = '\\b' +
|
||||
'(' +
|
||||
'0[bB]([01]+[01_]+[01]+|[01]+)' + // 0b...
|
||||
'|' +
|
||||
'0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)' + // 0x...
|
||||
'|' +
|
||||
'(' +
|
||||
'([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?' +
|
||||
'|' +
|
||||
'\\.([\\d]+[\\d_]+[\\d]+|[\\d]+)' +
|
||||
')' +
|
||||
'([eE][-+]?\\d+)?' + // octal, decimal, float
|
||||
')' +
|
||||
'[lLfF]?';
|
||||
var JAVA_NUMBER_MODE = {
|
||||
className: 'number',
|
||||
begin: JAVA_NUMBER_RE,
|
||||
relevance: 0
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'Java',
|
||||
aliases: ['jsp'],
|
||||
keywords: KEYWORDS,
|
||||
illegal: /<\/|#/,
|
||||
contains: [
|
||||
hljs.COMMENT(
|
||||
'/\\*\\*',
|
||||
'\\*/',
|
||||
{
|
||||
relevance : 0,
|
||||
contains : [
|
||||
{
|
||||
// eat up @'s in emails to prevent them to be recognized as doctags
|
||||
begin: /\w+@/, relevance: 0
|
||||
},
|
||||
{
|
||||
className : 'doctag',
|
||||
begin : '@[A-Za-z]+'
|
||||
}
|
||||
]
|
||||
}
|
||||
),
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
{
|
||||
className: 'class',
|
||||
beginKeywords: 'class interface', end: /[{;=]/, excludeEnd: true,
|
||||
keywords: 'class interface',
|
||||
illegal: /[:"\[\]]/,
|
||||
contains: [
|
||||
{beginKeywords: 'extends implements'},
|
||||
hljs.UNDERSCORE_TITLE_MODE
|
||||
]
|
||||
},
|
||||
{
|
||||
// Expression keywords prevent 'keyword Name(...)' from being
|
||||
// recognized as a function definition
|
||||
beginKeywords: 'new throw return else',
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
className: 'function',
|
||||
begin: '(' + GENERIC_IDENT_RE + '\\s+)+' + hljs.UNDERSCORE_IDENT_RE + '\\s*\\(', returnBegin: true, end: /[{;=]/,
|
||||
excludeEnd: true,
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
{
|
||||
begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(', returnBegin: true,
|
||||
relevance: 0,
|
||||
contains: [hljs.UNDERSCORE_TITLE_MODE]
|
||||
},
|
||||
{
|
||||
className: 'params',
|
||||
begin: /\(/, end: /\)/,
|
||||
keywords: KEYWORDS,
|
||||
relevance: 0,
|
||||
contains: [
|
||||
ANNOTATION,
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.C_NUMBER_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE
|
||||
]
|
||||
},
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE
|
||||
]
|
||||
},
|
||||
JAVA_NUMBER_MODE,
|
||||
ANNOTATION
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
Language: JavaScript
|
||||
Description: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.
|
||||
Category: common, scripting
|
||||
Website: https://developer.mozilla.org/en-US/docs/Web/JavaScript
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var FRAGMENT = {
|
||||
begin: '<>',
|
||||
end: '</>'
|
||||
};
|
||||
var XML_TAG = {
|
||||
begin: /<[A-Za-z0-9\\._:-]+/,
|
||||
end: /\/[A-Za-z0-9\\._:-]+>|\/>/
|
||||
};
|
||||
var IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
|
||||
var KEYWORDS = {
|
||||
keyword:
|
||||
'in of if for while finally var new function do return void else break catch ' +
|
||||
'instanceof with throw case default try this switch continue typeof delete ' +
|
||||
'let yield const export super debugger as async await static ' +
|
||||
// ECMAScript 6 modules import
|
||||
'import from as'
|
||||
,
|
||||
literal:
|
||||
'true false null undefined NaN Infinity',
|
||||
built_in:
|
||||
'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' +
|
||||
'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' +
|
||||
'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' +
|
||||
'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
|
||||
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
|
||||
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
|
||||
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' +
|
||||
'Promise'
|
||||
};
|
||||
var NUMBER = {
|
||||
className: 'number',
|
||||
variants: [
|
||||
{ begin: '\\b(0[bB][01]+)n?' },
|
||||
{ begin: '\\b(0[oO][0-7]+)n?' },
|
||||
{ begin: hljs.C_NUMBER_RE + 'n?' }
|
||||
],
|
||||
relevance: 0
|
||||
};
|
||||
var SUBST = {
|
||||
className: 'subst',
|
||||
begin: '\\$\\{', end: '\\}',
|
||||
keywords: KEYWORDS,
|
||||
contains: [] // defined later
|
||||
};
|
||||
var HTML_TEMPLATE = {
|
||||
begin: 'html`', end: '',
|
||||
starts: {
|
||||
end: '`', returnEnd: false,
|
||||
contains: [
|
||||
hljs.BACKSLASH_ESCAPE,
|
||||
SUBST
|
||||
],
|
||||
subLanguage: 'xml',
|
||||
}
|
||||
};
|
||||
var CSS_TEMPLATE = {
|
||||
begin: 'css`', end: '',
|
||||
starts: {
|
||||
end: '`', returnEnd: false,
|
||||
contains: [
|
||||
hljs.BACKSLASH_ESCAPE,
|
||||
SUBST
|
||||
],
|
||||
subLanguage: 'css',
|
||||
}
|
||||
};
|
||||
var TEMPLATE_STRING = {
|
||||
className: 'string',
|
||||
begin: '`', end: '`',
|
||||
contains: [
|
||||
hljs.BACKSLASH_ESCAPE,
|
||||
SUBST
|
||||
]
|
||||
};
|
||||
SUBST.contains = [
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
HTML_TEMPLATE,
|
||||
CSS_TEMPLATE,
|
||||
TEMPLATE_STRING,
|
||||
NUMBER,
|
||||
hljs.REGEXP_MODE
|
||||
];
|
||||
var PARAMS_CONTAINS = SUBST.contains.concat([
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
hljs.C_LINE_COMMENT_MODE
|
||||
]);
|
||||
var PARAMS = {
|
||||
className: 'params',
|
||||
begin: /\(/, end: /\)/,
|
||||
excludeBegin: true,
|
||||
excludeEnd: true,
|
||||
contains: PARAMS_CONTAINS
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'JavaScript',
|
||||
aliases: ['js', 'jsx', 'mjs', 'cjs'],
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
{
|
||||
className: 'meta',
|
||||
relevance: 10,
|
||||
begin: /^\s*['"]use (strict|asm)['"]/
|
||||
},
|
||||
{
|
||||
className: 'meta',
|
||||
begin: /^#!/, end: /$/
|
||||
},
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
HTML_TEMPLATE,
|
||||
CSS_TEMPLATE,
|
||||
TEMPLATE_STRING,
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.COMMENT(
|
||||
'/\\*\\*',
|
||||
'\\*/',
|
||||
{
|
||||
relevance : 0,
|
||||
contains : [
|
||||
{
|
||||
className : 'doctag',
|
||||
begin : '@[A-Za-z]+',
|
||||
contains : [
|
||||
{
|
||||
className: 'type',
|
||||
begin: '\\{',
|
||||
end: '\\}',
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
className: 'variable',
|
||||
begin: IDENT_RE + '(?=\\s*(-)|$)',
|
||||
endsParent: true,
|
||||
relevance: 0
|
||||
},
|
||||
// eat spaces (not newlines) so we can find
|
||||
// types or variables
|
||||
{
|
||||
begin: /(?=[^\n])\s/,
|
||||
relevance: 0
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
),
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
NUMBER,
|
||||
{ // object attr container
|
||||
begin: /[{,\n]\s*/, relevance: 0,
|
||||
contains: [
|
||||
{
|
||||
begin: IDENT_RE + '\\s*:', returnBegin: true,
|
||||
relevance: 0,
|
||||
contains: [{className: 'attr', begin: IDENT_RE, relevance: 0}]
|
||||
}
|
||||
]
|
||||
},
|
||||
{ // "value" container
|
||||
begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
|
||||
keywords: 'return throw case',
|
||||
contains: [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
hljs.REGEXP_MODE,
|
||||
{
|
||||
className: 'function',
|
||||
begin: '(\\(.*?\\)|' + IDENT_RE + ')\\s*=>', returnBegin: true,
|
||||
end: '\\s*=>',
|
||||
contains: [
|
||||
{
|
||||
className: 'params',
|
||||
variants: [
|
||||
{
|
||||
begin: IDENT_RE
|
||||
},
|
||||
{
|
||||
begin: /\(\s*\)/,
|
||||
},
|
||||
{
|
||||
begin: /\(/, end: /\)/,
|
||||
excludeBegin: true, excludeEnd: true,
|
||||
keywords: KEYWORDS,
|
||||
contains: PARAMS_CONTAINS
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{ // could be a comma delimited list of params to a function call
|
||||
begin: /,/, relevance: 0,
|
||||
},
|
||||
{
|
||||
className: '',
|
||||
begin: /\s/,
|
||||
end: /\s*/,
|
||||
skip: true,
|
||||
},
|
||||
{ // JSX
|
||||
variants: [
|
||||
{ begin: FRAGMENT.begin, end: FRAGMENT.end },
|
||||
{ begin: XML_TAG.begin, end: XML_TAG.end }
|
||||
],
|
||||
subLanguage: 'xml',
|
||||
contains: [
|
||||
{
|
||||
begin: XML_TAG.begin, end: XML_TAG.end, skip: true,
|
||||
contains: ['self']
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
className: 'function',
|
||||
beginKeywords: 'function', end: /\{/, excludeEnd: true,
|
||||
contains: [
|
||||
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}),
|
||||
PARAMS
|
||||
],
|
||||
illegal: /\[|%/
|
||||
},
|
||||
{
|
||||
begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
|
||||
},
|
||||
|
||||
hljs.METHOD_GUARD,
|
||||
{ // ES6 class
|
||||
className: 'class',
|
||||
beginKeywords: 'class', end: /[{;=]/, excludeEnd: true,
|
||||
illegal: /[:"\[\]]/,
|
||||
contains: [
|
||||
{beginKeywords: 'extends'},
|
||||
hljs.UNDERSCORE_TITLE_MODE
|
||||
]
|
||||
},
|
||||
{
|
||||
beginKeywords: 'constructor', end: /\{/, excludeEnd: true
|
||||
},
|
||||
{
|
||||
begin:'(get|set)\\s*(?=' + IDENT_RE+ '\\()',
|
||||
end: /{/,
|
||||
keywords: "get set",
|
||||
contains: [
|
||||
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}),
|
||||
{ begin: /\(\)/ }, // eat to avoid empty params
|
||||
PARAMS
|
||||
]
|
||||
|
||||
}
|
||||
],
|
||||
illegal: /#(?!!)/
|
||||
};
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Language: JSON
|
||||
Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format.
|
||||
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
Website: http://www.json.org
|
||||
Category: common, protocols
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var LITERALS = {literal: 'true false null'};
|
||||
var ALLOWED_COMMENTS = [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE
|
||||
]
|
||||
var TYPES = [
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.C_NUMBER_MODE
|
||||
];
|
||||
var VALUE_CONTAINER = {
|
||||
end: ',', endsWithParent: true, excludeEnd: true,
|
||||
contains: TYPES,
|
||||
keywords: LITERALS
|
||||
};
|
||||
var OBJECT = {
|
||||
begin: '{', end: '}',
|
||||
contains: [
|
||||
{
|
||||
className: 'attr',
|
||||
begin: /"/, end: /"/,
|
||||
contains: [hljs.BACKSLASH_ESCAPE],
|
||||
illegal: '\\n',
|
||||
},
|
||||
hljs.inherit(VALUE_CONTAINER, {begin: /:/})
|
||||
].concat(ALLOWED_COMMENTS),
|
||||
illegal: '\\S'
|
||||
};
|
||||
var ARRAY = {
|
||||
begin: '\\[', end: '\\]',
|
||||
contains: [hljs.inherit(VALUE_CONTAINER)], // inherit is a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents
|
||||
illegal: '\\S'
|
||||
};
|
||||
TYPES.push(OBJECT, ARRAY);
|
||||
ALLOWED_COMMENTS.forEach(function(rule) {
|
||||
TYPES.push(rule)
|
||||
})
|
||||
return {
|
||||
name: 'JSON',
|
||||
contains: TYPES,
|
||||
keywords: LITERALS,
|
||||
illegal: '\\S'
|
||||
};
|
||||
}
|
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
Language: Less
|
||||
Description: It's CSS, with just a little more.
|
||||
Author: Max Mikhailov <seven.phases.max@gmail.com>
|
||||
Website: http://lesscss.org
|
||||
Category: common, css
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var IDENT_RE = '[\\w-]+'; // yes, Less identifiers may begin with a digit
|
||||
var INTERP_IDENT_RE = '(' + IDENT_RE + '|@{' + IDENT_RE + '})';
|
||||
|
||||
/* Generic Modes */
|
||||
|
||||
var RULES = [], VALUE = []; // forward def. for recursive modes
|
||||
|
||||
var STRING_MODE = function(c) { return {
|
||||
// Less strings are not multiline (also include '~' for more consistent coloring of "escaped" strings)
|
||||
className: 'string', begin: '~?' + c + '.*?' + c
|
||||
};};
|
||||
|
||||
var IDENT_MODE = function(name, begin, relevance) { return {
|
||||
className: name, begin: begin, relevance: relevance
|
||||
};};
|
||||
|
||||
var PARENS_MODE = {
|
||||
// used only to properly balance nested parens inside mixin call, def. arg list
|
||||
begin: '\\(', end: '\\)', contains: VALUE, relevance: 0
|
||||
};
|
||||
|
||||
// generic Less highlighter (used almost everywhere except selectors):
|
||||
VALUE.push(
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
STRING_MODE("'"),
|
||||
STRING_MODE('"'),
|
||||
hljs.CSS_NUMBER_MODE, // fixme: it does not include dot for numbers like .5em :(
|
||||
{
|
||||
begin: '(url|data-uri)\\(',
|
||||
starts: {className: 'string', end: '[\\)\\n]', excludeEnd: true}
|
||||
},
|
||||
IDENT_MODE('number', '#[0-9A-Fa-f]+\\b'),
|
||||
PARENS_MODE,
|
||||
IDENT_MODE('variable', '@@?' + IDENT_RE, 10),
|
||||
IDENT_MODE('variable', '@{' + IDENT_RE + '}'),
|
||||
IDENT_MODE('built_in', '~?`[^`]*?`'), // inline javascript (or whatever host language) *multiline* string
|
||||
{ // @media features (it’s here to not duplicate things in AT_RULE_MODE with extra PARENS_MODE overriding):
|
||||
className: 'attribute', begin: IDENT_RE + '\\s*:', end: ':', returnBegin: true, excludeEnd: true
|
||||
},
|
||||
{
|
||||
className: 'meta',
|
||||
begin: '!important'
|
||||
}
|
||||
);
|
||||
|
||||
var VALUE_WITH_RULESETS = VALUE.concat({
|
||||
begin: '{', end: '}', contains: RULES
|
||||
});
|
||||
|
||||
var MIXIN_GUARD_MODE = {
|
||||
beginKeywords: 'when', endsWithParent: true,
|
||||
contains: [{beginKeywords: 'and not'}].concat(VALUE) // using this form to override VALUE’s 'function' match
|
||||
};
|
||||
|
||||
/* Rule-Level Modes */
|
||||
|
||||
var RULE_MODE = {
|
||||
begin: INTERP_IDENT_RE + '\\s*:', returnBegin: true, end: '[;}]',
|
||||
relevance: 0,
|
||||
contains: [
|
||||
{
|
||||
className: 'attribute',
|
||||
begin: INTERP_IDENT_RE, end: ':', excludeEnd: true,
|
||||
starts: {
|
||||
endsWithParent: true, illegal: '[<=$]',
|
||||
relevance: 0,
|
||||
contains: VALUE
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var AT_RULE_MODE = {
|
||||
className: 'keyword',
|
||||
begin: '@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b',
|
||||
starts: {end: '[;{}]', returnEnd: true, contains: VALUE, relevance: 0}
|
||||
};
|
||||
|
||||
// variable definitions and calls
|
||||
var VAR_RULE_MODE = {
|
||||
className: 'variable',
|
||||
variants: [
|
||||
// using more strict pattern for higher relevance to increase chances of Less detection.
|
||||
// this is *the only* Less specific statement used in most of the sources, so...
|
||||
// (we’ll still often loose to the css-parser unless there's '//' comment,
|
||||
// simply because 1 variable just can't beat 99 properties :)
|
||||
{begin: '@' + IDENT_RE + '\\s*:', relevance: 15},
|
||||
{begin: '@' + IDENT_RE}
|
||||
],
|
||||
starts: {end: '[;}]', returnEnd: true, contains: VALUE_WITH_RULESETS}
|
||||
};
|
||||
|
||||
var SELECTOR_MODE = {
|
||||
// first parse unambiguous selectors (i.e. those not starting with tag)
|
||||
// then fall into the scary lookahead-discriminator variant.
|
||||
// this mode also handles mixin definitions and calls
|
||||
variants: [{
|
||||
begin: '[\\.#:&\\[>]', end: '[;{}]' // mixin calls end with ';'
|
||||
}, {
|
||||
begin: INTERP_IDENT_RE, end: '{'
|
||||
}],
|
||||
returnBegin: true,
|
||||
returnEnd: true,
|
||||
illegal: '[<=\'$"]',
|
||||
relevance: 0,
|
||||
contains: [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
MIXIN_GUARD_MODE,
|
||||
IDENT_MODE('keyword', 'all\\b'),
|
||||
IDENT_MODE('variable', '@{' + IDENT_RE + '}'), // otherwise it’s identified as tag
|
||||
IDENT_MODE('selector-tag', INTERP_IDENT_RE + '%?', 0), // '%' for more consistent coloring of @keyframes "tags"
|
||||
IDENT_MODE('selector-id', '#' + INTERP_IDENT_RE),
|
||||
IDENT_MODE('selector-class', '\\.' + INTERP_IDENT_RE, 0),
|
||||
IDENT_MODE('selector-tag', '&', 0),
|
||||
{className: 'selector-attr', begin: '\\[', end: '\\]'},
|
||||
{className: 'selector-pseudo', begin: /:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},
|
||||
{begin: '\\(', end: '\\)', contains: VALUE_WITH_RULESETS}, // argument list of parametric mixins
|
||||
{begin: '!important'} // eat !important after mixin call or it will be colored as tag
|
||||
]
|
||||
};
|
||||
|
||||
RULES.push(
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
AT_RULE_MODE,
|
||||
VAR_RULE_MODE,
|
||||
RULE_MODE,
|
||||
SELECTOR_MODE
|
||||
);
|
||||
|
||||
return {
|
||||
name: 'Less',
|
||||
case_insensitive: true,
|
||||
illegal: '[=>\'/<($"]',
|
||||
contains: RULES
|
||||
};
|
||||
}
|
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
Language: Nginx config
|
||||
Author: Peter Leonov <gojpeg@yandex.ru>
|
||||
Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
Category: common, config
|
||||
Website: https://www.nginx.com
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var VAR = {
|
||||
className: 'variable',
|
||||
variants: [
|
||||
{begin: /\$\d+/},
|
||||
{begin: /\$\{/, end: /}/},
|
||||
{begin: '[\\$\\@]' + hljs.UNDERSCORE_IDENT_RE}
|
||||
]
|
||||
};
|
||||
var DEFAULT = {
|
||||
endsWithParent: true,
|
||||
lexemes: '[a-z/_]+',
|
||||
keywords: {
|
||||
literal:
|
||||
'on off yes no true false none blocked debug info notice warn error crit ' +
|
||||
'select break last permanent redirect kqueue rtsig epoll poll /dev/poll'
|
||||
},
|
||||
relevance: 0,
|
||||
illegal: '=>',
|
||||
contains: [
|
||||
hljs.HASH_COMMENT_MODE,
|
||||
{
|
||||
className: 'string',
|
||||
contains: [hljs.BACKSLASH_ESCAPE, VAR],
|
||||
variants: [
|
||||
{begin: /"/, end: /"/},
|
||||
{begin: /'/, end: /'/}
|
||||
]
|
||||
},
|
||||
// this swallows entire URLs to avoid detecting numbers within
|
||||
{
|
||||
begin: '([a-z]+):/', end: '\\s', endsWithParent: true, excludeEnd: true,
|
||||
contains: [VAR]
|
||||
},
|
||||
{
|
||||
className: 'regexp',
|
||||
contains: [hljs.BACKSLASH_ESCAPE, VAR],
|
||||
variants: [
|
||||
{begin: "\\s\\^", end: "\\s|{|;", returnEnd: true},
|
||||
// regexp locations (~, ~*)
|
||||
{begin: "~\\*?\\s+", end: "\\s|{|;", returnEnd: true},
|
||||
// *.example.com
|
||||
{begin: "\\*(\\.[a-z\\-]+)+"},
|
||||
// sub.example.*
|
||||
{begin: "([a-z\\-]+\\.)+\\*"}
|
||||
]
|
||||
},
|
||||
// IP
|
||||
{
|
||||
className: 'number',
|
||||
begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b'
|
||||
},
|
||||
// units
|
||||
{
|
||||
className: 'number',
|
||||
begin: '\\b\\d+[kKmMgGdshdwy]*\\b',
|
||||
relevance: 0
|
||||
},
|
||||
VAR
|
||||
]
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'Nginx config',
|
||||
aliases: ['nginxconf'],
|
||||
contains: [
|
||||
hljs.HASH_COMMENT_MODE,
|
||||
{
|
||||
begin: hljs.UNDERSCORE_IDENT_RE + '\\s+{', returnBegin: true,
|
||||
end: '{',
|
||||
contains: [
|
||||
{
|
||||
className: 'section',
|
||||
begin: hljs.UNDERSCORE_IDENT_RE
|
||||
}
|
||||
],
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
begin: hljs.UNDERSCORE_IDENT_RE + '\\s', end: ';|{', returnBegin: true,
|
||||
contains: [
|
||||
{
|
||||
className: 'attribute',
|
||||
begin: hljs.UNDERSCORE_IDENT_RE,
|
||||
starts: DEFAULT
|
||||
}
|
||||
],
|
||||
relevance: 0
|
||||
}
|
||||
],
|
||||
illegal: '[^\\s\\}]'
|
||||
};
|
||||
}
|
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
Language: PHP
|
||||
Author: Victor Karamzin <Victor.Karamzin@enterra-inc.com>
|
||||
Contributors: Evgeny Stepanischev <imbolk@gmail.com>, Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
Website: https://www.php.net
|
||||
Category: common
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var VARIABLE = {
|
||||
begin: '\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
|
||||
};
|
||||
var PREPROCESSOR = {
|
||||
className: 'meta',
|
||||
variants: [
|
||||
{ begin: /<\?php/, relevance: 10 }, // boost for obvious PHP
|
||||
{ begin: /<\?[=]?/ },
|
||||
{ begin: /\?>/ } // end php tag
|
||||
]
|
||||
};
|
||||
var STRING = {
|
||||
className: 'string',
|
||||
contains: [hljs.BACKSLASH_ESCAPE, PREPROCESSOR],
|
||||
variants: [
|
||||
{
|
||||
begin: 'b"', end: '"'
|
||||
},
|
||||
{
|
||||
begin: 'b\'', end: '\''
|
||||
},
|
||||
hljs.inherit(hljs.APOS_STRING_MODE, {illegal: null}),
|
||||
hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})
|
||||
]
|
||||
};
|
||||
var NUMBER = {variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]};
|
||||
var KEYWORDS = {
|
||||
keyword:
|
||||
// Magic constants:
|
||||
// <https://www.php.net/manual/en/language.constants.predefined.php>
|
||||
'__CLASS__ __DIR__ __FILE__ __FUNCTION__ __LINE__ __METHOD__ __NAMESPACE__ __TRAIT__ ' +
|
||||
// Function that look like language construct or language construct that look like function:
|
||||
// List of keywords that may not require parenthesis
|
||||
'die echo exit include include_once print require require_once ' +
|
||||
// These are not language construct (function) but operate on the currently-executing function and can access the current symbol table
|
||||
// 'compact extract func_get_arg func_get_args func_num_args get_called_class get_parent_class ' +
|
||||
// Other keywords:
|
||||
// <https://www.php.net/manual/en/reserved.php>
|
||||
// <https://www.php.net/manual/en/language.types.type-juggling.php>
|
||||
'array abstract and as binary bool boolean break callable case catch class clone const continue declare default do double else elseif empty enddeclare endfor endforeach endif endswitch endwhile eval extends final finally float for foreach from global goto if implements instanceof insteadof int integer interface isset iterable list new object or private protected public real return string switch throw trait try unset use var void while xor yield',
|
||||
literal: 'false null true',
|
||||
built_in:
|
||||
// Standard PHP library:
|
||||
// <https://www.php.net/manual/en/book.spl.php>
|
||||
'Error|0 ' + // error is too common a name esp since PHP is case in-sensitive
|
||||
'AppendIterator ArgumentCountError ArithmeticError ArrayIterator ArrayObject AssertionError BadFunctionCallException BadMethodCallException CachingIterator CallbackFilterIterator CompileError Countable DirectoryIterator DivisionByZeroError DomainException EmptyIterator ErrorException Exception FilesystemIterator FilterIterator GlobIterator InfiniteIterator InvalidArgumentException IteratorIterator LengthException LimitIterator LogicException MultipleIterator NoRewindIterator OutOfBoundsException OutOfRangeException OuterIterator OverflowException ParentIterator ParseError RangeException RecursiveArrayIterator RecursiveCachingIterator RecursiveCallbackFilterIterator RecursiveDirectoryIterator RecursiveFilterIterator RecursiveIterator RecursiveIteratorIterator RecursiveRegexIterator RecursiveTreeIterator RegexIterator RuntimeException SeekableIterator SplDoublyLinkedList SplFileInfo SplFileObject SplFixedArray SplHeap SplMaxHeap SplMinHeap SplObjectStorage SplObserver SplObserver SplPriorityQueue SplQueue SplStack SplSubject SplSubject SplTempFileObject TypeError UnderflowException UnexpectedValueException ' +
|
||||
// Reserved interfaces:
|
||||
// <https://www.php.net/manual/en/reserved.interfaces.php>
|
||||
'ArrayAccess Closure Generator Iterator IteratorAggregate Serializable Throwable Traversable WeakReference ' +
|
||||
// Reserved classes:
|
||||
// <https://www.php.net/manual/en/reserved.classes.php>
|
||||
'Directory __PHP_Incomplete_Class parent php_user_filter self static stdClass'
|
||||
};
|
||||
return {
|
||||
aliases: ['php', 'php3', 'php4', 'php5', 'php6', 'php7'],
|
||||
case_insensitive: true,
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
hljs.HASH_COMMENT_MODE,
|
||||
hljs.COMMENT('//', '$', {contains: [PREPROCESSOR]}),
|
||||
hljs.COMMENT(
|
||||
'/\\*',
|
||||
'\\*/',
|
||||
{
|
||||
contains: [
|
||||
{
|
||||
className: 'doctag',
|
||||
begin: '@[A-Za-z]+'
|
||||
}
|
||||
]
|
||||
}
|
||||
),
|
||||
hljs.COMMENT(
|
||||
'__halt_compiler.+?;',
|
||||
false,
|
||||
{
|
||||
endsWithParent: true,
|
||||
keywords: '__halt_compiler',
|
||||
lexemes: hljs.UNDERSCORE_IDENT_RE
|
||||
}
|
||||
),
|
||||
{
|
||||
className: 'string',
|
||||
begin: /<<<['"]?\w+['"]?$/, end: /^\w+;?$/,
|
||||
contains: [
|
||||
hljs.BACKSLASH_ESCAPE,
|
||||
{
|
||||
className: 'subst',
|
||||
variants: [
|
||||
{begin: /\$\w+/},
|
||||
{begin: /\{\$/, end: /\}/}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
PREPROCESSOR,
|
||||
{
|
||||
className: 'keyword', begin: /\$this\b/
|
||||
},
|
||||
VARIABLE,
|
||||
{
|
||||
// swallow composed identifiers to avoid parsing them as keywords
|
||||
begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
|
||||
},
|
||||
{
|
||||
className: 'function',
|
||||
beginKeywords: 'fn function', end: /[;{]/, excludeEnd: true,
|
||||
illegal: '[$%\\[]',
|
||||
contains: [
|
||||
hljs.UNDERSCORE_TITLE_MODE,
|
||||
{
|
||||
className: 'params',
|
||||
begin: '\\(', end: '\\)',
|
||||
excludeBegin: true,
|
||||
excludeEnd: true,
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
'self',
|
||||
VARIABLE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
STRING,
|
||||
NUMBER
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
className: 'class',
|
||||
beginKeywords: 'class interface', end: '{', excludeEnd: true,
|
||||
illegal: /[:\(\$"]/,
|
||||
contains: [
|
||||
{beginKeywords: 'extends implements'},
|
||||
hljs.UNDERSCORE_TITLE_MODE
|
||||
]
|
||||
},
|
||||
{
|
||||
beginKeywords: 'namespace', end: ';',
|
||||
illegal: /[\.']/,
|
||||
contains: [hljs.UNDERSCORE_TITLE_MODE]
|
||||
},
|
||||
{
|
||||
beginKeywords: 'use', end: ';',
|
||||
contains: [hljs.UNDERSCORE_TITLE_MODE]
|
||||
},
|
||||
{
|
||||
begin: '=>' // No markup, just a relevance booster
|
||||
},
|
||||
STRING,
|
||||
NUMBER
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
Language: Python REPL
|
||||
Requires: python.js
|
||||
Author: Josh Goebel <hello@joshgoebel.com>
|
||||
Category: common
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
return {
|
||||
aliases: ['pycon'],
|
||||
contains: [
|
||||
{
|
||||
className: 'meta',
|
||||
starts: {
|
||||
// a space separates the REPL prefix from the actual code
|
||||
// this is purely for cleaner HTML output
|
||||
end: / |$/,
|
||||
starts: {
|
||||
end: '$', subLanguage: 'python'
|
||||
}
|
||||
},
|
||||
variants: [
|
||||
{ begin: /^>>>(?=[ ]|$)/ },
|
||||
{ begin: /^\.\.\.(?=[ ]|$)/ }
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
Language: Python
|
||||
Description: Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
|
||||
Website: https://www.python.org
|
||||
Category: common
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var KEYWORDS = {
|
||||
keyword:
|
||||
'and elif is global as in if from raise for except finally print import pass return ' +
|
||||
'exec else break not with class assert yield try while continue del or def lambda ' +
|
||||
'async await nonlocal|10',
|
||||
built_in:
|
||||
'Ellipsis NotImplemented',
|
||||
literal: 'False None True'
|
||||
};
|
||||
var PROMPT = {
|
||||
className: 'meta', begin: /^(>>>|\.\.\.) /
|
||||
};
|
||||
var SUBST = {
|
||||
className: 'subst',
|
||||
begin: /\{/, end: /\}/,
|
||||
keywords: KEYWORDS,
|
||||
illegal: /#/
|
||||
};
|
||||
var LITERAL_BRACKET = {
|
||||
begin: /\{\{/,
|
||||
relevance: 0
|
||||
};
|
||||
var STRING = {
|
||||
className: 'string',
|
||||
contains: [hljs.BACKSLASH_ESCAPE],
|
||||
variants: [
|
||||
{
|
||||
begin: /(u|b)?r?'''/, end: /'''/,
|
||||
contains: [hljs.BACKSLASH_ESCAPE, PROMPT],
|
||||
relevance: 10
|
||||
},
|
||||
{
|
||||
begin: /(u|b)?r?"""/, end: /"""/,
|
||||
contains: [hljs.BACKSLASH_ESCAPE, PROMPT],
|
||||
relevance: 10
|
||||
},
|
||||
{
|
||||
begin: /(fr|rf|f)'''/, end: /'''/,
|
||||
contains: [hljs.BACKSLASH_ESCAPE, PROMPT, LITERAL_BRACKET, SUBST]
|
||||
},
|
||||
{
|
||||
begin: /(fr|rf|f)"""/, end: /"""/,
|
||||
contains: [hljs.BACKSLASH_ESCAPE, PROMPT, LITERAL_BRACKET, SUBST]
|
||||
},
|
||||
{
|
||||
begin: /(u|r|ur)'/, end: /'/,
|
||||
relevance: 10
|
||||
},
|
||||
{
|
||||
begin: /(u|r|ur)"/, end: /"/,
|
||||
relevance: 10
|
||||
},
|
||||
{
|
||||
begin: /(b|br)'/, end: /'/
|
||||
},
|
||||
{
|
||||
begin: /(b|br)"/, end: /"/
|
||||
},
|
||||
{
|
||||
begin: /(fr|rf|f)'/, end: /'/,
|
||||
contains: [hljs.BACKSLASH_ESCAPE, LITERAL_BRACKET, SUBST]
|
||||
},
|
||||
{
|
||||
begin: /(fr|rf|f)"/, end: /"/,
|
||||
contains: [hljs.BACKSLASH_ESCAPE, LITERAL_BRACKET, SUBST]
|
||||
},
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE
|
||||
]
|
||||
};
|
||||
var NUMBER = {
|
||||
className: 'number', relevance: 0,
|
||||
variants: [
|
||||
{begin: hljs.BINARY_NUMBER_RE + '[lLjJ]?'},
|
||||
{begin: '\\b(0o[0-7]+)[lLjJ]?'},
|
||||
{begin: hljs.C_NUMBER_RE + '[lLjJ]?'}
|
||||
]
|
||||
};
|
||||
var PARAMS = {
|
||||
className: 'params',
|
||||
begin: /\(/, end: /\)/,
|
||||
contains: ['self', PROMPT, NUMBER, STRING, hljs.HASH_COMMENT_MODE]
|
||||
};
|
||||
SUBST.contains = [STRING, NUMBER, PROMPT];
|
||||
return {
|
||||
name: 'Python',
|
||||
aliases: ['py', 'gyp', 'ipython'],
|
||||
keywords: KEYWORDS,
|
||||
illegal: /(<\/|->|\?)|=>/,
|
||||
contains: [
|
||||
PROMPT,
|
||||
NUMBER,
|
||||
// eat "if" prior to string so that it won't accidentally be
|
||||
// labeled as an f-string as in:
|
||||
{ beginKeywords: "if", relevance: 0 },
|
||||
STRING,
|
||||
hljs.HASH_COMMENT_MODE,
|
||||
{
|
||||
variants: [
|
||||
{className: 'function', beginKeywords: 'def'},
|
||||
{className: 'class', beginKeywords: 'class'}
|
||||
],
|
||||
end: /:/,
|
||||
illegal: /[${=;\n,]/,
|
||||
contains: [
|
||||
hljs.UNDERSCORE_TITLE_MODE,
|
||||
PARAMS,
|
||||
{
|
||||
begin: /->/, endsWithParent: true,
|
||||
keywords: 'None'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
className: 'meta',
|
||||
begin: /^[\t ]*@/, end: /$/
|
||||
},
|
||||
{
|
||||
begin: /\b(print|exec)\(/ // don’t highlight keywords-turned-functions in Python 3
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
Language: SCSS
|
||||
Description: Scss is an extension of the syntax of CSS.
|
||||
Author: Kurt Emch <kurt@kurtemch.com>
|
||||
Website: https://sass-lang.com
|
||||
Category: common, css
|
||||
*/
|
||||
export default function(hljs) {
|
||||
var AT_IDENTIFIER = '@[a-z-]+' // @font-face
|
||||
var AT_MODIFIERS = "and or not only"
|
||||
var IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*';
|
||||
var VARIABLE = {
|
||||
className: 'variable',
|
||||
begin: '(\\$' + IDENT_RE + ')\\b'
|
||||
};
|
||||
var HEXCOLOR = {
|
||||
className: 'number', begin: '#[0-9A-Fa-f]+'
|
||||
};
|
||||
var DEF_INTERNALS = {
|
||||
className: 'attribute',
|
||||
begin: '[A-Z\\_\\.\\-]+', end: ':',
|
||||
excludeEnd: true,
|
||||
illegal: '[^\\s]',
|
||||
starts: {
|
||||
endsWithParent: true, excludeEnd: true,
|
||||
contains: [
|
||||
HEXCOLOR,
|
||||
hljs.CSS_NUMBER_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
{
|
||||
className: 'meta', begin: '!important'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
return {
|
||||
name: 'SCSS',
|
||||
case_insensitive: true,
|
||||
illegal: '[=/|\']',
|
||||
contains: [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
{
|
||||
className: 'selector-id', begin: '\\#[A-Za-z0-9_-]+',
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
className: 'selector-class', begin: '\\.[A-Za-z0-9_-]+',
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
className: 'selector-attr', begin: '\\[', end: '\\]',
|
||||
illegal: '$'
|
||||
},
|
||||
{
|
||||
className: 'selector-tag', // begin: IDENT_RE, end: '[,|\\s]'
|
||||
begin: '\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b',
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
className: 'selector-pseudo',
|
||||
begin: ':(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)'
|
||||
},
|
||||
{
|
||||
className: 'selector-pseudo',
|
||||
begin: '::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)'
|
||||
},
|
||||
VARIABLE,
|
||||
{
|
||||
className: 'attribute',
|
||||
begin: '\\b(src|z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b',
|
||||
illegal: '[^\\s]'
|
||||
},
|
||||
{
|
||||
begin: '\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b'
|
||||
},
|
||||
{
|
||||
begin: ':', end: ';',
|
||||
contains: [
|
||||
VARIABLE,
|
||||
HEXCOLOR,
|
||||
hljs.CSS_NUMBER_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.APOS_STRING_MODE,
|
||||
{
|
||||
className: 'meta', begin: '!important'
|
||||
}
|
||||
]
|
||||
},
|
||||
// matching these here allows us to treat them more like regular CSS
|
||||
// rules so everything between the {} gets regular rule highlighting,
|
||||
// which is what we want for page and font-face
|
||||
{
|
||||
begin: '@(page|font-face)',
|
||||
lexemes: AT_IDENTIFIER,
|
||||
keywords: '@page @font-face'
|
||||
},
|
||||
{
|
||||
begin: '@', end: '[{;]',
|
||||
returnBegin: true,
|
||||
keywords: AT_MODIFIERS,
|
||||
contains: [
|
||||
{
|
||||
begin: AT_IDENTIFIER,
|
||||
className: "keyword"
|
||||
},
|
||||
VARIABLE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.APOS_STRING_MODE,
|
||||
HEXCOLOR,
|
||||
hljs.CSS_NUMBER_MODE,
|
||||
// {
|
||||
// begin: '\\s[A-Za-z0-9_.-]+',
|
||||
// relevance: 0
|
||||
// }
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Language: Shell Session
|
||||
Requires: bash.js
|
||||
Author: TSUYUSATO Kitsune <make.just.on@gmail.com>
|
||||
Category: common
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
return {
|
||||
name: 'Shell Session',
|
||||
aliases: ['console'],
|
||||
contains: [
|
||||
{
|
||||
className: 'meta',
|
||||
begin: '^\\s{0,3}[/\\w\\d\\[\\]()@-]*[>%$#]',
|
||||
starts: {
|
||||
end: '$', subLanguage: 'bash'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
Language: TypeScript
|
||||
Author: Panu Horsmalahti <panu.horsmalahti@iki.fi>
|
||||
Contributors: Ike Ku <dempfi@yahoo.com>
|
||||
Description: TypeScript is a strict superset of JavaScript
|
||||
Website: https://www.typescriptlang.org
|
||||
Category: common, scripting
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
|
||||
var KEYWORDS = {
|
||||
keyword:
|
||||
'in if for while finally var new function do return void else break catch ' +
|
||||
'instanceof with throw case default try this switch continue typeof delete ' +
|
||||
'let yield const class public private protected get set super ' +
|
||||
'static implements enum export import declare type namespace abstract ' +
|
||||
'as from extends async await',
|
||||
literal:
|
||||
'true false null undefined NaN Infinity',
|
||||
built_in:
|
||||
'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' +
|
||||
'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' +
|
||||
'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' +
|
||||
'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
|
||||
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
|
||||
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
|
||||
'module console window document any number boolean string void Promise'
|
||||
};
|
||||
|
||||
var DECORATOR = {
|
||||
className: 'meta',
|
||||
begin: '@' + JS_IDENT_RE,
|
||||
};
|
||||
|
||||
var ARGS =
|
||||
{
|
||||
begin: '\\(',
|
||||
end: /\)/,
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
'self',
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.NUMBER_MODE
|
||||
]
|
||||
};
|
||||
|
||||
var PARAMS = {
|
||||
className: 'params',
|
||||
begin: /\(/, end: /\)/,
|
||||
excludeBegin: true,
|
||||
excludeEnd: true,
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
DECORATOR,
|
||||
ARGS
|
||||
]
|
||||
};
|
||||
var NUMBER = {
|
||||
className: 'number',
|
||||
variants: [
|
||||
{ begin: '\\b(0[bB][01]+)n?' },
|
||||
{ begin: '\\b(0[oO][0-7]+)n?' },
|
||||
{ begin: hljs.C_NUMBER_RE + 'n?' }
|
||||
],
|
||||
relevance: 0
|
||||
};
|
||||
var SUBST = {
|
||||
className: 'subst',
|
||||
begin: '\\$\\{', end: '\\}',
|
||||
keywords: KEYWORDS,
|
||||
contains: [] // defined later
|
||||
};
|
||||
var HTML_TEMPLATE = {
|
||||
begin: 'html`', end: '',
|
||||
starts: {
|
||||
end: '`', returnEnd: false,
|
||||
contains: [
|
||||
hljs.BACKSLASH_ESCAPE,
|
||||
SUBST
|
||||
],
|
||||
subLanguage: 'xml',
|
||||
}
|
||||
};
|
||||
var CSS_TEMPLATE = {
|
||||
begin: 'css`', end: '',
|
||||
starts: {
|
||||
end: '`', returnEnd: false,
|
||||
contains: [
|
||||
hljs.BACKSLASH_ESCAPE,
|
||||
SUBST
|
||||
],
|
||||
subLanguage: 'css',
|
||||
}
|
||||
};
|
||||
var TEMPLATE_STRING = {
|
||||
className: 'string',
|
||||
begin: '`', end: '`',
|
||||
contains: [
|
||||
hljs.BACKSLASH_ESCAPE,
|
||||
SUBST
|
||||
]
|
||||
};
|
||||
SUBST.contains = [
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
HTML_TEMPLATE,
|
||||
CSS_TEMPLATE,
|
||||
TEMPLATE_STRING,
|
||||
NUMBER,
|
||||
hljs.REGEXP_MODE
|
||||
];
|
||||
|
||||
|
||||
|
||||
return {
|
||||
name: 'TypeScript',
|
||||
aliases: ['ts'],
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
{
|
||||
className: 'meta',
|
||||
begin: /^\s*['"]use strict['"]/
|
||||
},
|
||||
hljs.APOS_STRING_MODE,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
HTML_TEMPLATE,
|
||||
CSS_TEMPLATE,
|
||||
TEMPLATE_STRING,
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
NUMBER,
|
||||
{ // "value" container
|
||||
begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
|
||||
keywords: 'return throw case',
|
||||
contains: [
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE,
|
||||
hljs.REGEXP_MODE,
|
||||
{
|
||||
className: 'function',
|
||||
begin: '(\\(.*?\\)|' + hljs.IDENT_RE + ')\\s*=>', returnBegin: true,
|
||||
end: '\\s*=>',
|
||||
contains: [
|
||||
{
|
||||
className: 'params',
|
||||
variants: [
|
||||
{
|
||||
begin: hljs.IDENT_RE
|
||||
},
|
||||
{
|
||||
begin: /\(\s*\)/,
|
||||
},
|
||||
{
|
||||
begin: /\(/, end: /\)/,
|
||||
excludeBegin: true, excludeEnd: true,
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
'self',
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
className: 'function',
|
||||
beginKeywords: 'function', end: /[\{;]/, excludeEnd: true,
|
||||
keywords: KEYWORDS,
|
||||
contains: [
|
||||
'self',
|
||||
hljs.inherit(hljs.TITLE_MODE, { begin: JS_IDENT_RE }),
|
||||
PARAMS
|
||||
],
|
||||
illegal: /%/,
|
||||
relevance: 0 // () => {} is more typical in TypeScript
|
||||
},
|
||||
{
|
||||
beginKeywords: 'constructor', end: /[\{;]/, excludeEnd: true,
|
||||
contains: [
|
||||
'self',
|
||||
PARAMS
|
||||
]
|
||||
},
|
||||
{ // prevent references like module.id from being higlighted as module definitions
|
||||
begin: /module\./,
|
||||
keywords: { built_in: 'module' },
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
beginKeywords: 'module', end: /\{/, excludeEnd: true
|
||||
},
|
||||
{
|
||||
beginKeywords: 'interface', end: /\{/, excludeEnd: true,
|
||||
keywords: 'interface extends'
|
||||
},
|
||||
{
|
||||
begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
|
||||
},
|
||||
{
|
||||
begin: '\\.' + hljs.IDENT_RE, relevance: 0 // hack: prevents detection of keywords after dots
|
||||
},
|
||||
DECORATOR,
|
||||
ARGS
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
Language: HTML, XML
|
||||
Website: https://www.w3.org/XML/
|
||||
Category: common
|
||||
*/
|
||||
|
||||
export default function(hljs) {
|
||||
var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+';
|
||||
var XML_ENTITIES = {
|
||||
className: 'symbol',
|
||||
begin: '&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;'
|
||||
};
|
||||
var XML_META_KEYWORDS = {
|
||||
begin: '\\s',
|
||||
contains:[
|
||||
{
|
||||
className: 'meta-keyword',
|
||||
begin: '#?[a-z_][a-z1-9_-]+',
|
||||
illegal: '\\n',
|
||||
}
|
||||
]
|
||||
};
|
||||
var XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {begin: '\\(', end: '\\)'});
|
||||
var APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, {className: 'meta-string'});
|
||||
var QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, {className: 'meta-string'});
|
||||
var TAG_INTERNALS = {
|
||||
endsWithParent: true,
|
||||
illegal: /</,
|
||||
relevance: 0,
|
||||
contains: [
|
||||
{
|
||||
className: 'attr',
|
||||
begin: XML_IDENT_RE,
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
begin: /=\s*/,
|
||||
relevance: 0,
|
||||
contains: [
|
||||
{
|
||||
className: 'string',
|
||||
endsParent: true,
|
||||
variants: [
|
||||
{begin: /"/, end: /"/, contains: [XML_ENTITIES]},
|
||||
{begin: /'/, end: /'/, contains: [XML_ENTITIES]},
|
||||
{begin: /[^\s"'=<>`]+/}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
return {
|
||||
name: 'HTML, XML',
|
||||
aliases: ['html', 'xhtml', 'rss', 'atom', 'xjb', 'xsd', 'xsl', 'plist', 'wsf', 'svg'],
|
||||
case_insensitive: true,
|
||||
contains: [
|
||||
{
|
||||
className: 'meta',
|
||||
begin: '<![a-z]', end: '>',
|
||||
relevance: 10,
|
||||
contains: [
|
||||
XML_META_KEYWORDS,
|
||||
QUOTE_META_STRING_MODE,
|
||||
APOS_META_STRING_MODE,
|
||||
XML_META_PAR_KEYWORDS,
|
||||
{
|
||||
begin: '\\[', end: '\\]',
|
||||
contains:[
|
||||
{
|
||||
className: 'meta',
|
||||
begin: '<![a-z]', end: '>',
|
||||
contains: [
|
||||
XML_META_KEYWORDS,
|
||||
XML_META_PAR_KEYWORDS,
|
||||
QUOTE_META_STRING_MODE,
|
||||
APOS_META_STRING_MODE
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
hljs.COMMENT(
|
||||
'<!--',
|
||||
'-->',
|
||||
{
|
||||
relevance: 10
|
||||
}
|
||||
),
|
||||
{
|
||||
begin: '<\\!\\[CDATA\\[', end: '\\]\\]>',
|
||||
relevance: 10
|
||||
},
|
||||
XML_ENTITIES,
|
||||
{
|
||||
className: 'meta',
|
||||
begin: /<\?xml/, end: /\?>/, relevance: 10
|
||||
},
|
||||
{
|
||||
className: 'tag',
|
||||
/*
|
||||
The lookahead pattern (?=...) ensures that 'begin' only matches
|
||||
'<style' as a single word, followed by a whitespace or an
|
||||
ending braket. The '$' is needed for the lexeme to be recognized
|
||||
by hljs.subMode() that tests lexemes outside the stream.
|
||||
*/
|
||||
begin: '<style(?=\\s|>)', end: '>',
|
||||
keywords: {name: 'style'},
|
||||
contains: [TAG_INTERNALS],
|
||||
starts: {
|
||||
end: '</style>', returnEnd: true,
|
||||
subLanguage: ['css', 'xml']
|
||||
}
|
||||
},
|
||||
{
|
||||
className: 'tag',
|
||||
// See the comment in the <style tag about the lookahead pattern
|
||||
begin: '<script(?=\\s|>)', end: '>',
|
||||
keywords: {name: 'script'},
|
||||
contains: [TAG_INTERNALS],
|
||||
starts: {
|
||||
end: '\<\/script\>', returnEnd: true,
|
||||
subLanguage: ['javascript', 'handlebars', 'xml']
|
||||
}
|
||||
},
|
||||
{
|
||||
className: 'tag',
|
||||
begin: '</?', end: '/?>',
|
||||
contains: [
|
||||
{
|
||||
className: 'name', begin: /[^\/><\s]+/, relevance: 0
|
||||
},
|
||||
TAG_INTERNALS
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
|
||||
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
|
||||
|
||||
*/
|
||||
|
||||
.h2w-light .hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
color: #333;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-comment,
|
||||
.h2w-light .hljs-quote {
|
||||
color: #998;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-keyword,
|
||||
.h2w-light .hljs-selector-tag,
|
||||
.h2w-light .hljs-subst {
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-number,
|
||||
.h2w-light .hljs-literal,
|
||||
.h2w-light .hljs-variable,
|
||||
.h2w-light .hljs-template-variable,
|
||||
.h2w-light .hljs-tag .hljs-attr {
|
||||
color: #008080;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-string,
|
||||
.h2w-light .hljs-doctag {
|
||||
color: #d14;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-title,
|
||||
.h2w-light .hljs-section,
|
||||
.h2w-light .hljs-selector-id {
|
||||
color: #900;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-subst {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-type,
|
||||
.h2w-light .hljs-class .hljs-title {
|
||||
color: #458;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-tag,
|
||||
.h2w-light .hljs-name,
|
||||
.h2w-light .hljs-attribute {
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-regexp,
|
||||
.h2w-light .hljs-link {
|
||||
color: #009926;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-symbol,
|
||||
.h2w-light .hljs-bullet {
|
||||
color: #990073;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-built_in,
|
||||
.h2w-light .hljs-builtin-name {
|
||||
color: #0086b3;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-meta {
|
||||
color: #999;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-deletion {
|
||||
background: #fdd;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-addition {
|
||||
background: #dfd;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.h2w-light .hljs-strong {
|
||||
font-weight: bold;
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Monokai style - ported by Luigi Maselli - http://grigio.org
|
||||
*/
|
||||
|
||||
.h2w-dark .hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #272822; color: #ddd;
|
||||
}
|
||||
|
||||
.h2w-dark .hljs-tag,
|
||||
.h2w-dark .hljs-keyword,
|
||||
.h2w-dark .hljs-selector-tag,
|
||||
.h2w-dark .hljs-literal,
|
||||
.h2w-dark .hljs-strong,
|
||||
.h2w-dark .hljs-name {
|
||||
color: #f92672;
|
||||
}
|
||||
|
||||
.h2w-dark .hljs-code {
|
||||
color: #66d9ef;
|
||||
}
|
||||
|
||||
.h2w-dark .hljs-class .hljs-title {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.h2w-dark .hljs-attribute,
|
||||
.h2w-dark .hljs-symbol,
|
||||
.h2w-dark .hljs-regexp,
|
||||
.h2w-dark .hljs-link {
|
||||
color: #bf79db;
|
||||
}
|
||||
|
||||
.h2w-dark .hljs-string,
|
||||
.h2w-dark .hljs-bullet,
|
||||
.h2w-dark .hljs-subst,
|
||||
.h2w-dark .hljs-title,
|
||||
.h2w-dark .hljs-section,
|
||||
.h2w-dark .hljs-emphasis,
|
||||
.h2w-dark .hljs-type,
|
||||
.h2w-dark .hljs-built_in,
|
||||
.h2w-dark .hljs-builtin-name,
|
||||
.h2w-dark .hljs-selector-attr,
|
||||
.h2w-dark .hljs-selector-pseudo,
|
||||
.h2w-dark .hljs-addition,
|
||||
.h2w-dark .hljs-variable,
|
||||
.h2w-dark .hljs-template-tag,
|
||||
.h2w-dark .hljs-template-variable {
|
||||
color: #a6e22e;
|
||||
}
|
||||
|
||||
.h2w-dark .hljs-comment,
|
||||
.h2w-dark .hljs-quote,
|
||||
.h2w-dark .hljs-deletion,
|
||||
.h2w-dark .hljs-meta {
|
||||
color: #75715e;
|
||||
}
|
||||
|
||||
.h2w-dark .hljs-keyword,
|
||||
.h2w-dark .hljs-selector-tag,
|
||||
.h2w-dark .hljs-literal,
|
||||
.h2w-dark .hljs-doctag,
|
||||
.h2w-dark .hljs-title,
|
||||
.h2w-dark .hljs-section,
|
||||
.h2w-dark .hljs-type,
|
||||
.h2w-dark .hljs-selector-id {
|
||||
font-weight: bold;
|
||||
}
|
Reference in New Issue
Block a user