prism-rails 1.5.1 → 1.5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prism-rails/version.rb +1 -1
- data/vendor/assets/javascripts/prism-ada.js +19 -0
- data/vendor/assets/javascripts/prism-apl.js +2 -2
- data/vendor/assets/javascripts/prism-asciidoc.js +4 -4
- data/vendor/assets/javascripts/prism-autolinker.js +32 -26
- data/vendor/assets/javascripts/prism-autoloader.js +5 -1
- data/vendor/assets/javascripts/prism-bash.js +2 -2
- data/vendor/assets/javascripts/prism-css-extras.js +2 -1
- data/vendor/assets/javascripts/prism-css.js +4 -1
- data/vendor/assets/javascripts/prism-data-uri-highlight.js +98 -0
- data/vendor/assets/javascripts/prism-graphql.js +24 -0
- data/vendor/assets/javascripts/prism-groovy.js +2 -2
- data/vendor/assets/javascripts/prism-javascript.js +2 -1
- data/vendor/assets/javascripts/prism-json.js +4 -4
- data/vendor/assets/javascripts/prism-line-highlight.js +16 -15
- data/vendor/assets/javascripts/prism-line-numbers.js +1 -0
- data/vendor/assets/javascripts/prism-livescript.js +118 -0
- data/vendor/assets/javascripts/prism-markup.js +2 -2
- data/vendor/assets/javascripts/prism-normalize-whitespace.js +1 -1
- data/vendor/assets/javascripts/prism-php.js +2 -1
- data/vendor/assets/javascripts/prism-powershell.js +2 -2
- data/vendor/assets/javascripts/prism-properties.js +9 -0
- data/vendor/assets/javascripts/prism-puppet.js +1 -1
- data/vendor/assets/javascripts/prism-remove-initial-line-feed.js +1 -1
- data/vendor/assets/javascripts/prism-ruby.js +1 -1
- data/vendor/assets/javascripts/prism-scss.js +18 -3
- data/vendor/assets/javascripts/prism-show-language.js +1 -1
- data/vendor/assets/javascripts/prism-textile.js +3 -0
- data/vendor/assets/javascripts/prism-wpd.js +48 -45
- data/vendor/assets/javascripts/prism-xojo.js +20 -0
- data/vendor/assets/javascripts/prism.js +8 -3
- data/vendor/assets/stylesheets/prism-base16-ateliersulphurpool.light.css +20 -0
- data/vendor/assets/stylesheets/prism-coy.css +0 -14
- data/vendor/assets/stylesheets/prism-duotone-dark.css +19 -0
- data/vendor/assets/stylesheets/prism-duotone-earth.css +20 -0
- data/vendor/assets/stylesheets/prism-duotone-forest.css +20 -0
- data/vendor/assets/stylesheets/prism-duotone-light.css +20 -0
- data/vendor/assets/stylesheets/prism-duotone-sea.css +20 -0
- data/vendor/assets/stylesheets/prism-duotone-space.css +20 -0
- data/vendor/assets/stylesheets/prism-line-highlight.css +0 -3
- data/vendor/assets/stylesheets/prism-previewer-angle.css +0 -2
- data/vendor/assets/stylesheets/prism-previewer-base.css +0 -15
- data/vendor/assets/stylesheets/prism-previewer-gradient.css +0 -6
- data/vendor/assets/stylesheets/prism-previewer-time.css +0 -2
- data/vendor/assets/stylesheets/prism-show-language.css +0 -2
- data/vendor/assets/stylesheets/prism-twilight.css +0 -3
- data/vendor/assets/stylesheets/prism-vs.css +27 -9
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1437c16febe5cfcd2684f06663642f3d018be21
|
4
|
+
data.tar.gz: 35e33cbfe4869341a54bfe2bf0e98f20e804d250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d4abb000415f67252c81c8ea116170aecbc660b00394785c54118ff3983b4a57584a047a1fad469dc8dafa0c1ea905b4607bcc485bded54424adc709e3b130b
|
7
|
+
data.tar.gz: 5ed3ca00df1131d63907aa86e21b28a7448f8b21e2edbffeff2387daceb77f3fb45acdf2d59ba9d1e3087e6c7df8da8600e72a7bf184614eb1f1b2cbd6ecb85e
|
data/lib/prism-rails/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
Prism.languages.ada = {
|
2
|
+
'comment': /--.*/,
|
3
|
+
'string': /"(?:""|[^"\r\f\n])*"/i,
|
4
|
+
'number': [
|
5
|
+
{
|
6
|
+
pattern: /\b[0-9](?:_?[0-9])*#[0-9A-F](?:_?[0-9A-F])*(?:\.[0-9A-F](?:_?[0-9A-F])*)?#(?:E[+-]?[0-9](?:_?[0-9])*)?/i
|
7
|
+
},
|
8
|
+
{
|
9
|
+
pattern: /\b[0-9](?:_?[0-9])*(?:\.[0-9](?:_?[0-9])*)?(?:E[+-]?[0-9](?:_?[0-9])*)?\b/i
|
10
|
+
}
|
11
|
+
],
|
12
|
+
'attr-name': /\b'\w+/i,
|
13
|
+
'keyword': /\b(?:abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|not|null|of|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i,
|
14
|
+
'boolean': /\b(?:true|false)\b/i,
|
15
|
+
'operator': /<[=>]?|>=?|=>?|:=|\/=?|\*\*?|[&+-]/,
|
16
|
+
'punctuation': /\.\.?|[,;():]/,
|
17
|
+
'char': /'.'/,
|
18
|
+
'variable': /\b[a-z](?:[_a-z\d])*\b/i
|
19
|
+
};
|
@@ -8,7 +8,7 @@ Prism.languages.apl = {
|
|
8
8
|
alias: 'function'
|
9
9
|
},
|
10
10
|
'constant': /[⍬⌾#⎕⍞]/,
|
11
|
-
'function': /[
|
11
|
+
'function': /[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/,
|
12
12
|
'monadic-operator': {
|
13
13
|
pattern: /[\\\/⌿⍀¨⍨⌶&∥]/,
|
14
14
|
alias: 'operator'
|
@@ -26,4 +26,4 @@ Prism.languages.apl = {
|
|
26
26
|
pattern: /[{}⍺⍵⍶⍹∇⍫:]/,
|
27
27
|
alias: 'builtin'
|
28
28
|
}
|
29
|
-
};
|
29
|
+
};
|
@@ -27,7 +27,7 @@
|
|
27
27
|
};
|
28
28
|
Prism.languages.asciidoc = {
|
29
29
|
'comment-block': {
|
30
|
-
pattern: /^(\/{4,})(?:\r?\n|\r)(
|
30
|
+
pattern: /^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m,
|
31
31
|
alias: 'comment'
|
32
32
|
},
|
33
33
|
'table': {
|
@@ -46,7 +46,7 @@
|
|
46
46
|
},
|
47
47
|
|
48
48
|
'passthrough-block': {
|
49
|
-
pattern: /^(\+{4,})(?:\r?\n|\r)(
|
49
|
+
pattern: /^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
|
50
50
|
inside: {
|
51
51
|
'punctuation': /^\++|\++$/
|
52
52
|
// See rest below
|
@@ -54,7 +54,7 @@
|
|
54
54
|
},
|
55
55
|
// Literal blocks and listing blocks
|
56
56
|
'literal-block': {
|
57
|
-
pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(
|
57
|
+
pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
|
58
58
|
inside: {
|
59
59
|
'punctuation': /^(?:-+|\.+)|(?:-+|\.+)$/
|
60
60
|
// See rest below
|
@@ -62,7 +62,7 @@
|
|
62
62
|
},
|
63
63
|
// Sidebar blocks, quote blocks, example blocks and open blocks
|
64
64
|
'other-block': {
|
65
|
-
pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(
|
65
|
+
pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
|
66
66
|
inside: {
|
67
67
|
'punctuation': /^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/
|
68
68
|
// See rest below
|
@@ -14,36 +14,42 @@ var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:#=?&]+/,
|
|
14
14
|
// Tokens that may contain URLs and emails
|
15
15
|
candidates = ['comment', 'url', 'attr-value', 'string'];
|
16
16
|
|
17
|
-
Prism.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
if (
|
25
|
-
def
|
26
|
-
|
27
|
-
|
28
|
-
|
17
|
+
Prism.plugins.autolinker = {
|
18
|
+
processGrammar: function (grammar) {
|
19
|
+
// Abort if grammar has already been processed
|
20
|
+
if (!grammar || grammar['url-link']) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
Prism.languages.DFS(grammar, function (key, def, type) {
|
24
|
+
if (candidates.indexOf(type) > -1 && Prism.util.type(def) !== 'Array') {
|
25
|
+
if (!def.pattern) {
|
26
|
+
def = this[key] = {
|
27
|
+
pattern: def
|
28
|
+
};
|
29
|
+
}
|
29
30
|
|
30
|
-
|
31
|
+
def.inside = def.inside || {};
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
if (type == 'comment') {
|
34
|
+
def.inside['md-link'] = linkMd;
|
35
|
+
}
|
36
|
+
if (type == 'attr-value') {
|
37
|
+
Prism.languages.insertBefore('inside', 'punctuation', { 'url-link': url }, def);
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
def.inside['url-link'] = url;
|
41
|
+
}
|
42
|
+
|
43
|
+
def.inside['email-link'] = email;
|
40
44
|
}
|
45
|
+
});
|
46
|
+
grammar['url-link'] = url;
|
47
|
+
grammar['email-link'] = email;
|
48
|
+
}
|
49
|
+
};
|
41
50
|
|
42
|
-
|
43
|
-
|
44
|
-
});
|
45
|
-
env.grammar['url-link'] = url;
|
46
|
-
env.grammar['email-link'] = email;
|
51
|
+
Prism.hooks.add('before-highlight', function(env) {
|
52
|
+
Prism.plugins.autolinker.processGrammar(env.grammar);
|
47
53
|
});
|
48
54
|
|
49
55
|
Prism.hooks.add('wrap', function(env) {
|
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
var lang_data = {};
|
10
10
|
|
11
|
+
var ignored_language = 'none';
|
12
|
+
|
11
13
|
var config = Prism.plugins.autoloader = {
|
12
14
|
languages_path: 'components/',
|
13
15
|
use_minified: true
|
@@ -187,7 +189,9 @@
|
|
187
189
|
|
188
190
|
Prism.hooks.add('complete', function (env) {
|
189
191
|
if (env.element && env.language && !env.grammar) {
|
190
|
-
|
192
|
+
if (env.language !== ignored_language) {
|
193
|
+
registerElement(env.language, env.element);
|
194
|
+
}
|
191
195
|
}
|
192
196
|
});
|
193
197
|
|
@@ -56,7 +56,7 @@
|
|
56
56
|
'variable': insideString.variable,
|
57
57
|
// Originally based on http://ss64.com/bash/
|
58
58
|
'function': {
|
59
|
-
pattern: /(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,
|
59
|
+
pattern: /(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,
|
60
60
|
lookbehind: true
|
61
61
|
},
|
62
62
|
'keyword': {
|
@@ -77,4 +77,4 @@
|
|
77
77
|
inside.boolean = Prism.languages.bash.boolean;
|
78
78
|
inside.operator = Prism.languages.bash.operator;
|
79
79
|
inside.punctuation = Prism.languages.bash.punctuation;
|
80
|
-
})(Prism);
|
80
|
+
})(Prism);
|
@@ -4,7 +4,8 @@ Prism.languages.css.selector = {
|
|
4
4
|
'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
|
5
5
|
'pseudo-class': /:[-\w]+(?:\(.*\))?/,
|
6
6
|
'class': /\.[-:\.\w]+/,
|
7
|
-
'id': /#[-:\.\w]
|
7
|
+
'id': /#[-:\.\w]+/,
|
8
|
+
'attribute': /\[[^\]]+\]/
|
8
9
|
}
|
9
10
|
};
|
10
11
|
|
@@ -9,7 +9,10 @@ Prism.languages.css = {
|
|
9
9
|
},
|
10
10
|
'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
|
11
11
|
'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/,
|
12
|
-
'string':
|
12
|
+
'string': {
|
13
|
+
pattern: /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,
|
14
|
+
greedy: true
|
15
|
+
},
|
13
16
|
'property': /(\b|\B)[\w-]+(?=\s*:)/i,
|
14
17
|
'important': /\B!important\b/i,
|
15
18
|
'function': /[-a-z0-9]+(?=\()/i,
|
@@ -0,0 +1,98 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
if (
|
4
|
+
typeof self !== 'undefined' && !self.Prism ||
|
5
|
+
typeof global !== 'undefined' && !global.Prism
|
6
|
+
) {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
|
10
|
+
var autoLinkerProcess = function (grammar) {
|
11
|
+
if (Prism.plugins.autolinker) {
|
12
|
+
Prism.plugins.autolinker.processGrammar(grammar);
|
13
|
+
}
|
14
|
+
return grammar;
|
15
|
+
};
|
16
|
+
var dataURI = {
|
17
|
+
pattern: /(.)\bdata:[^\/]+\/[^,]+,(?:(?!\1)[\s\S]|\\\1)+(?=\1)/,
|
18
|
+
lookbehind: true,
|
19
|
+
inside: {
|
20
|
+
'language-css': {
|
21
|
+
pattern: /(data:[^\/]+\/(?:[^+,]+\+)?css,)[\s\S]+/,
|
22
|
+
lookbehind: true
|
23
|
+
},
|
24
|
+
'language-javascript': {
|
25
|
+
pattern: /(data:[^\/]+\/(?:[^+,]+\+)?javascript,)[\s\S]+/,
|
26
|
+
lookbehind: true
|
27
|
+
},
|
28
|
+
'language-json': {
|
29
|
+
pattern: /(data:[^\/]+\/(?:[^+,]+\+)?json,)[\s\S]+/,
|
30
|
+
lookbehind: true
|
31
|
+
},
|
32
|
+
'language-markup': {
|
33
|
+
pattern: /(data:[^\/]+\/(?:[^+,]+\+)?(?:html|xml),)[\s\S]+/,
|
34
|
+
lookbehind: true
|
35
|
+
}
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
// Tokens that may contain URLs
|
40
|
+
var candidates = ['url', 'attr-value', 'string'];
|
41
|
+
|
42
|
+
Prism.plugins.dataURIHighlight = {
|
43
|
+
processGrammar: function (grammar) {
|
44
|
+
// Abort if grammar has already been processed
|
45
|
+
if (!grammar || grammar['data-uri']) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
|
49
|
+
Prism.languages.DFS(grammar, function (key, def, type) {
|
50
|
+
if (candidates.indexOf(type) > -1 && Prism.util.type(def) !== 'Array') {
|
51
|
+
if (!def.pattern) {
|
52
|
+
def = this[key] = {
|
53
|
+
pattern: def
|
54
|
+
};
|
55
|
+
}
|
56
|
+
|
57
|
+
def.inside = def.inside || {};
|
58
|
+
|
59
|
+
if (type == 'attr-value') {
|
60
|
+
Prism.languages.insertBefore('inside', def.inside['url-link'] ? 'url-link' : 'punctuation', {
|
61
|
+
'data-uri': dataURI
|
62
|
+
}, def);
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
if (def.inside['url-link']) {
|
66
|
+
Prism.languages.insertBefore('inside', 'url-link', {
|
67
|
+
'data-uri': dataURI
|
68
|
+
}, def);
|
69
|
+
} else {
|
70
|
+
def.inside['data-uri'] = dataURI;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
});
|
75
|
+
grammar['data-uri'] = dataURI;
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
Prism.hooks.add('before-highlight', function (env) {
|
80
|
+
// Prepare the needed grammars for this code block
|
81
|
+
if (dataURI.pattern.test(env.code)) {
|
82
|
+
for (var p in dataURI.inside) {
|
83
|
+
if (dataURI.inside.hasOwnProperty(p)) {
|
84
|
+
if (!dataURI.inside[p].inside && dataURI.inside[p].pattern.test(env.code)) {
|
85
|
+
var lang = p.match(/^language-(.+)/)[1];
|
86
|
+
if (Prism.languages[lang]) {
|
87
|
+
dataURI.inside[p].inside = {
|
88
|
+
rest: autoLinkerProcess(Prism.languages[lang])
|
89
|
+
};
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
Prism.plugins.dataURIHighlight.processGrammar(env.grammar);
|
97
|
+
});
|
98
|
+
}());
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Prism.languages.graphql = {
|
2
|
+
'comment': /#.*/,
|
3
|
+
'string': {
|
4
|
+
pattern: /"(?:\\.|[^\\"])*"/,
|
5
|
+
greedy: true
|
6
|
+
},
|
7
|
+
'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/,
|
8
|
+
'boolean': /\b(?:true|false)\b/,
|
9
|
+
'variable': /\$[a-z_]\w*/i,
|
10
|
+
'directive': {
|
11
|
+
pattern: /@[a-z_]\w*/i,
|
12
|
+
alias: 'function'
|
13
|
+
},
|
14
|
+
'attr-name': /[a-z_]\w*(?=\s*:)/i,
|
15
|
+
'keyword': [
|
16
|
+
{
|
17
|
+
pattern: /(fragment\s+(?!on)[a-z_]\w*\s+|\.\.\.\s*)on\b/,
|
18
|
+
lookbehind: true
|
19
|
+
},
|
20
|
+
/\b(?:query|fragment|mutation)\b/
|
21
|
+
],
|
22
|
+
'operator': /!|=|\.{3}/,
|
23
|
+
'punctuation': /[!(){}\[\]:=,]/
|
24
|
+
};
|
@@ -8,7 +8,7 @@ Prism.languages.groovy = Prism.languages.extend('clike', {
|
|
8
8
|
{
|
9
9
|
pattern: /("|'|\/)(?:\\?.)*?\1/,
|
10
10
|
greedy: true
|
11
|
-
}
|
11
|
+
}
|
12
12
|
],
|
13
13
|
'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?[\d]+)?)[glidf]?\b/i,
|
14
14
|
'operator': {
|
@@ -48,7 +48,7 @@ Prism.hooks.add('wrap', function(env) {
|
|
48
48
|
pattern = /([^\$])(\$(\{.*?\}|[\w\.]+))/;
|
49
49
|
}
|
50
50
|
|
51
|
-
// To prevent double HTML-
|
51
|
+
// To prevent double HTML-encoding we have to decode env.content first
|
52
52
|
env.content = env.content.replace(/&/g, '&').replace(/</g, '<');
|
53
53
|
|
54
54
|
env.content = Prism.highlight(env.content, {
|
@@ -2,7 +2,8 @@ Prism.languages.javascript = Prism.languages.extend('clike', {
|
|
2
2
|
'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,
|
3
3
|
'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
|
4
4
|
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
5
|
-
'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i
|
5
|
+
'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,
|
6
|
+
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/
|
6
7
|
});
|
7
8
|
|
8
9
|
Prism.languages.insertBefore('javascript', 'keyword', {
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Prism.languages.json = {
|
2
|
-
'property': /"
|
3
|
-
'string': /"(?!:)(
|
4
|
-
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]
|
2
|
+
'property': /"(?:\\.|[^|"])*"(?=\s*:)/ig,
|
3
|
+
'string': /"(?!:)(?:\\.|[^|"])*"(?!:)/g,
|
4
|
+
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?)\b/g,
|
5
5
|
'punctuation': /[{}[\]);,]/g,
|
6
6
|
'operator': /:/g,
|
7
7
|
'boolean': /\b(true|false)\b/gi,
|
8
|
-
'null': /\bnull\b/gi
|
8
|
+
'null': /\bnull\b/gi
|
9
9
|
};
|
10
10
|
|
11
11
|
Prism.languages.jsonp = Prism.languages.json;
|
@@ -51,26 +51,27 @@ function highlightLines(pre, lines, classes) {
|
|
51
51
|
var line = document.createElement('div');
|
52
52
|
|
53
53
|
line.textContent = Array(end - start + 2).join(' \n');
|
54
|
+
line.setAttribute('aria-hidden', 'true');
|
54
55
|
line.className = (classes || '') + ' line-highlight';
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
//if the line-numbers plugin is enabled, then there is no reason for this plugin to display the line numbers
|
58
|
+
if(!hasClass(pre, 'line-numbers')) {
|
59
|
+
line.setAttribute('data-start', start);
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
if(end > start) {
|
62
|
+
line.setAttribute('data-end', end);
|
63
|
+
}
|
64
|
+
}
|
64
65
|
|
65
66
|
line.style.top = (start - offset - 1) * lineHeight + 'px';
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
68
|
+
//allow this to play nicely with the line-numbers plugin
|
69
|
+
if(hasClass(pre, 'line-numbers')) {
|
70
|
+
//need to attack to pre as when line-numbers is enabled, the code tag is relatively which screws up the positioning
|
71
|
+
pre.appendChild(line);
|
72
|
+
} else {
|
73
|
+
(pre.querySelector('code') || pre).appendChild(line);
|
74
|
+
}
|
74
75
|
}
|
75
76
|
}
|
76
77
|
|
@@ -90,7 +91,7 @@ function applyHash() {
|
|
90
91
|
|
91
92
|
var id = hash.slice(0, hash.lastIndexOf('.')),
|
92
93
|
pre = document.getElementById(id);
|
93
|
-
|
94
|
+
|
94
95
|
if (!pre) {
|
95
96
|
return;
|
96
97
|
}
|
@@ -42,6 +42,7 @@ Prism.hooks.add('complete', function (env) {
|
|
42
42
|
lines = lines.join('<span></span>');
|
43
43
|
|
44
44
|
lineNumbersWrapper = document.createElement('span');
|
45
|
+
lineNumbersWrapper.setAttribute('aria-hidden', 'true');
|
45
46
|
lineNumbersWrapper.className = 'line-numbers-rows';
|
46
47
|
lineNumbersWrapper.innerHTML = lines;
|
47
48
|
|