Update prism/tomorrow-theme-custom/js/prism-plugins.js
This commit is contained in:
parent
9dac019aaa
commit
a2a272c84f
@ -1,480 +1,480 @@
|
||||
// Versions: 1.29.0
|
||||
// Toolbar
|
||||
!function() {
|
||||
if ('undefined' != typeof Prism && 'undefined' != typeof document) {
|
||||
var e = [], t = {}, n = function() {
|
||||
};
|
||||
Prism.plugins.toolbar = {};
|
||||
var a = Prism.plugins.toolbar.registerButton = function(n, a) {
|
||||
var r;
|
||||
r = 'function' == typeof a ? a : function(e) {
|
||||
var t;
|
||||
return 'function' == typeof a.onClick ? ((t = document.createElement('button')).type = 'button', t.addEventListener('click', (function() {
|
||||
a.onClick.call(this, e);
|
||||
}))) : 'string' == typeof a.url ? (t = document.createElement('a')).href = a.url : t = document.createElement('span'), a.className && t.classList.add(a.className), t.textContent = a.text, t;
|
||||
}, n in t ? console.warn('There is a button with the key "' + n + '" registered already.') : e.push(t[n] = r);
|
||||
}, r = Prism.plugins.toolbar.hook = function(a) {
|
||||
var r = a.element.parentNode;
|
||||
if (r && /pre/i.test(r.nodeName) && !r.parentNode.classList.contains('code-toolbar')) {
|
||||
var o = document.createElement('div');
|
||||
o.classList.add('code-toolbar'), r.parentNode.insertBefore(o, r), o.appendChild(r);
|
||||
var i = document.createElement('div');
|
||||
i.classList.add('toolbar');
|
||||
var l = e, d = function(e) {
|
||||
for (; e;) {
|
||||
var t = e.getAttribute('data-toolbar-order');
|
||||
if (null != t) return (t = t.trim()).length ? t.split(/\s*,\s*/g) : [];
|
||||
e = e.parentElement;
|
||||
}
|
||||
}(a.element);
|
||||
d && (l = d.map((function(e) {
|
||||
return t[e] || n;
|
||||
}))), l.forEach((function(e) {
|
||||
var t = e(a);
|
||||
if (t) {
|
||||
var n = document.createElement('div');
|
||||
n.classList.add('toolbar-item'), n.appendChild(t), i.appendChild(n);
|
||||
}
|
||||
})), o.appendChild(i);
|
||||
}
|
||||
};
|
||||
a('label', (function(e) {
|
||||
var t = e.element.parentNode;
|
||||
if (t && /pre/i.test(t.nodeName) && t.hasAttribute('data-label')) {
|
||||
var n, a, r = t.getAttribute('data-label');
|
||||
try {
|
||||
a = document.querySelector('template#' + r);
|
||||
} catch (e) {
|
||||
}
|
||||
return a ? n = a.content : (t.hasAttribute('data-url') ? (n = document.createElement('a')).href = t.getAttribute('data-url') : n = document.createElement('span'), n.textContent = r), n;
|
||||
}
|
||||
})), Prism.hooks.add('complete', r);
|
||||
}
|
||||
}();
|
||||
// Show Language
|
||||
!function() {
|
||||
if ('undefined' != typeof Prism && 'undefined' != typeof document) if (Prism.plugins.toolbar) {
|
||||
var e = {
|
||||
none: 'Plain text',
|
||||
plain: 'Plain text',
|
||||
plaintext: 'Plain text',
|
||||
text: 'Plain text',
|
||||
txt: 'Plain text',
|
||||
html: 'HTML',
|
||||
xml: 'XML',
|
||||
svg: 'SVG',
|
||||
mathml: 'MathML',
|
||||
ssml: 'SSML',
|
||||
rss: 'RSS',
|
||||
css: 'CSS',
|
||||
clike: 'C-like',
|
||||
js: 'JavaScript',
|
||||
abap: 'ABAP',
|
||||
abnf: 'ABNF',
|
||||
al: 'AL',
|
||||
antlr4: 'ANTLR4',
|
||||
g4: 'ANTLR4',
|
||||
apacheconf: 'Apache Configuration',
|
||||
apl: 'APL',
|
||||
aql: 'AQL',
|
||||
ino: 'Arduino',
|
||||
arff: 'ARFF',
|
||||
armasm: 'ARM Assembly',
|
||||
'arm-asm': 'ARM Assembly',
|
||||
art: 'Arturo',
|
||||
asciidoc: 'AsciiDoc',
|
||||
adoc: 'AsciiDoc',
|
||||
aspnet: 'ASP.NET (C#)',
|
||||
asm6502: '6502 Assembly',
|
||||
asmatmel: 'Atmel AVR Assembly',
|
||||
autohotkey: 'AutoHotkey',
|
||||
autoit: 'AutoIt',
|
||||
avisynth: 'AviSynth',
|
||||
avs: 'AviSynth',
|
||||
'avro-idl': 'Avro IDL',
|
||||
avdl: 'Avro IDL',
|
||||
awk: 'AWK',
|
||||
gawk: 'GAWK',
|
||||
sh: 'Shell',
|
||||
basic: 'BASIC',
|
||||
bbcode: 'BBcode',
|
||||
bbj: 'BBj',
|
||||
bnf: 'BNF',
|
||||
rbnf: 'RBNF',
|
||||
bqn: 'BQN',
|
||||
bsl: 'BSL (1C:Enterprise)',
|
||||
oscript: 'OneScript',
|
||||
csharp: 'C#',
|
||||
cs: 'C#',
|
||||
dotnet: 'C#',
|
||||
cpp: 'C++',
|
||||
cfscript: 'CFScript',
|
||||
cfc: 'CFScript',
|
||||
cil: 'CIL',
|
||||
cilkc: 'Cilk/C',
|
||||
'cilk-c': 'Cilk/C',
|
||||
cilkcpp: 'Cilk/C++',
|
||||
'cilk-cpp': 'Cilk/C++',
|
||||
cilk: 'Cilk/C++',
|
||||
cmake: 'CMake',
|
||||
cobol: 'COBOL',
|
||||
coffee: 'CoffeeScript',
|
||||
conc: 'Concurnas',
|
||||
csp: 'Content-Security-Policy',
|
||||
'css-extras': 'CSS Extras',
|
||||
csv: 'CSV',
|
||||
cue: 'CUE',
|
||||
dataweave: 'DataWeave',
|
||||
dax: 'DAX',
|
||||
django: 'Django/Jinja2',
|
||||
jinja2: 'Django/Jinja2',
|
||||
'dns-zone-file': 'DNS zone file',
|
||||
'dns-zone': 'DNS zone file',
|
||||
dockerfile: 'Docker',
|
||||
dot: 'DOT (Graphviz)',
|
||||
gv: 'DOT (Graphviz)',
|
||||
ebnf: 'EBNF',
|
||||
editorconfig: 'EditorConfig',
|
||||
ejs: 'EJS',
|
||||
etlua: 'Embedded Lua templating',
|
||||
erb: 'ERB',
|
||||
'excel-formula': 'Excel Formula',
|
||||
xlsx: 'Excel Formula',
|
||||
xls: 'Excel Formula',
|
||||
fsharp: 'F#',
|
||||
'firestore-security-rules': 'Firestore security rules',
|
||||
ftl: 'FreeMarker Template Language',
|
||||
gml: 'GameMaker Language',
|
||||
gamemakerlanguage: 'GameMaker Language',
|
||||
gap: 'GAP (CAS)',
|
||||
gcode: 'G-code',
|
||||
gdscript: 'GDScript',
|
||||
gedcom: 'GEDCOM',
|
||||
gettext: 'gettext',
|
||||
po: 'gettext',
|
||||
glsl: 'GLSL',
|
||||
gn: 'GN',
|
||||
gni: 'GN',
|
||||
'linker-script': 'GNU Linker Script',
|
||||
ld: 'GNU Linker Script',
|
||||
'go-module': 'Go module',
|
||||
'go-mod': 'Go module',
|
||||
graphql: 'GraphQL',
|
||||
hbs: 'Handlebars',
|
||||
hs: 'Haskell',
|
||||
hcl: 'HCL',
|
||||
hlsl: 'HLSL',
|
||||
http: 'HTTP',
|
||||
hpkp: 'HTTP Public-Key-Pins',
|
||||
hsts: 'HTTP Strict-Transport-Security',
|
||||
ichigojam: 'IchigoJam',
|
||||
'icu-message-format': 'ICU Message Format',
|
||||
idr: 'Idris',
|
||||
ignore: '.ignore',
|
||||
gitignore: '.gitignore',
|
||||
hgignore: '.hgignore',
|
||||
npmignore: '.npmignore',
|
||||
inform7: 'Inform 7',
|
||||
javadoc: 'JavaDoc',
|
||||
javadoclike: 'JavaDoc-like',
|
||||
javastacktrace: 'Java stack trace',
|
||||
jq: 'JQ',
|
||||
jsdoc: 'JSDoc',
|
||||
'js-extras': 'JS Extras',
|
||||
json: 'JSON',
|
||||
webmanifest: 'Web App Manifest',
|
||||
json5: 'JSON5',
|
||||
jsonp: 'JSONP',
|
||||
jsstacktrace: 'JS stack trace',
|
||||
'js-templates': 'JS Templates',
|
||||
keepalived: 'Keepalived Configure',
|
||||
kts: 'Kotlin Script',
|
||||
kt: 'Kotlin',
|
||||
kumir: 'KuMir (КуМир)',
|
||||
kum: 'KuMir (КуМир)',
|
||||
latex: 'LaTeX',
|
||||
tex: 'TeX',
|
||||
context: 'ConTeXt',
|
||||
lilypond: 'LilyPond',
|
||||
ly: 'LilyPond',
|
||||
emacs: 'Lisp',
|
||||
elisp: 'Lisp',
|
||||
'emacs-lisp': 'Lisp',
|
||||
llvm: 'LLVM IR',
|
||||
log: 'Log file',
|
||||
lolcode: 'LOLCODE',
|
||||
magma: 'Magma (CAS)',
|
||||
md: 'Markdown',
|
||||
'markup-templating': 'Markup templating',
|
||||
matlab: 'MATLAB',
|
||||
maxscript: 'MAXScript',
|
||||
mel: 'MEL',
|
||||
metafont: 'METAFONT',
|
||||
mongodb: 'MongoDB',
|
||||
moon: 'MoonScript',
|
||||
n1ql: 'N1QL',
|
||||
n4js: 'N4JS',
|
||||
n4jsd: 'N4JS',
|
||||
'nand2tetris-hdl': 'Nand To Tetris HDL',
|
||||
naniscript: 'Naninovel Script',
|
||||
nani: 'Naninovel Script',
|
||||
nasm: 'NASM',
|
||||
neon: 'NEON',
|
||||
nginx: 'nginx',
|
||||
nsis: 'NSIS',
|
||||
objectivec: 'Objective-C',
|
||||
objc: 'Objective-C',
|
||||
ocaml: 'OCaml',
|
||||
opencl: 'OpenCL',
|
||||
openqasm: 'OpenQasm',
|
||||
qasm: 'OpenQasm',
|
||||
parigp: 'PARI/GP',
|
||||
objectpascal: 'Object Pascal',
|
||||
psl: 'PATROL Scripting Language',
|
||||
pcaxis: 'PC-Axis',
|
||||
px: 'PC-Axis',
|
||||
peoplecode: 'PeopleCode',
|
||||
pcode: 'PeopleCode',
|
||||
php: 'PHP',
|
||||
phpdoc: 'PHPDoc',
|
||||
'php-extras': 'PHP Extras',
|
||||
'plant-uml': 'PlantUML',
|
||||
plantuml: 'PlantUML',
|
||||
plsql: 'PL/SQL',
|
||||
powerquery: 'PowerQuery',
|
||||
pq: 'PowerQuery',
|
||||
mscript: 'PowerQuery',
|
||||
powershell: 'PowerShell',
|
||||
promql: 'PromQL',
|
||||
properties: '.properties',
|
||||
protobuf: 'Protocol Buffers',
|
||||
purebasic: 'PureBasic',
|
||||
pbfasm: 'PureBasic',
|
||||
purs: 'PureScript',
|
||||
py: 'Python',
|
||||
qsharp: 'Q#',
|
||||
qs: 'Q#',
|
||||
q: 'Q (kdb+ database)',
|
||||
qml: 'QML',
|
||||
rkt: 'Racket',
|
||||
cshtml: 'Razor C#',
|
||||
razor: 'Razor C#',
|
||||
jsx: 'React JSX',
|
||||
tsx: 'React TSX',
|
||||
renpy: 'Ren\'py',
|
||||
rpy: 'Ren\'py',
|
||||
res: 'ReScript',
|
||||
rest: 'reST (reStructuredText)',
|
||||
robotframework: 'Robot Framework',
|
||||
robot: 'Robot Framework',
|
||||
rb: 'Ruby',
|
||||
sas: 'SAS',
|
||||
sass: 'Sass (Sass)',
|
||||
scss: 'Sass (SCSS)',
|
||||
'shell-session': 'Shell session',
|
||||
'sh-session': 'Shell session',
|
||||
shellsession: 'Shell session',
|
||||
sml: 'SML',
|
||||
smlnj: 'SML/NJ',
|
||||
solidity: 'Solidity (Ethereum)',
|
||||
sol: 'Solidity (Ethereum)',
|
||||
'solution-file': 'Solution file',
|
||||
sln: 'Solution file',
|
||||
soy: 'Soy (Closure Template)',
|
||||
sparql: 'SPARQL',
|
||||
rq: 'SPARQL',
|
||||
'splunk-spl': 'Splunk SPL',
|
||||
sqf: 'SQF: Status Quo Function (Arma 3)',
|
||||
sql: 'SQL',
|
||||
stata: 'Stata Ado',
|
||||
iecst: 'Structured Text (IEC 61131-3)',
|
||||
supercollider: 'SuperCollider',
|
||||
sclang: 'SuperCollider',
|
||||
systemd: 'Systemd configuration file',
|
||||
't4-templating': 'T4 templating',
|
||||
't4-cs': 'T4 Text Templates (C#)',
|
||||
t4: 'T4 Text Templates (C#)',
|
||||
't4-vb': 'T4 Text Templates (VB)',
|
||||
tap: 'TAP',
|
||||
tt2: 'Template Toolkit 2',
|
||||
toml: 'TOML',
|
||||
trickle: 'trickle',
|
||||
troy: 'troy',
|
||||
trig: 'TriG',
|
||||
ts: 'TypeScript',
|
||||
tsconfig: 'TSConfig',
|
||||
uscript: 'UnrealScript',
|
||||
uc: 'UnrealScript',
|
||||
uorazor: 'UO Razor Script',
|
||||
uri: 'URI',
|
||||
url: 'URL',
|
||||
vbnet: 'VB.Net',
|
||||
vhdl: 'VHDL',
|
||||
vim: 'vim',
|
||||
'visual-basic': 'Visual Basic',
|
||||
vba: 'VBA',
|
||||
vb: 'Visual Basic',
|
||||
wasm: 'WebAssembly',
|
||||
'web-idl': 'Web IDL',
|
||||
webidl: 'Web IDL',
|
||||
wgsl: 'WGSL',
|
||||
wiki: 'Wiki markup',
|
||||
wolfram: 'Wolfram language',
|
||||
nb: 'Mathematica Notebook',
|
||||
wl: 'Wolfram language',
|
||||
xeoracube: 'XeoraCube',
|
||||
'xml-doc': 'XML doc (.net)',
|
||||
xojo: 'Xojo (REALbasic)',
|
||||
xquery: 'XQuery',
|
||||
yaml: 'YAML',
|
||||
yml: 'YAML',
|
||||
yang: 'YANG',
|
||||
};
|
||||
Prism.plugins.toolbar.registerButton('show-language', (function(a) {
|
||||
var t = a.element.parentNode;
|
||||
if (t && /pre/i.test(t.nodeName)) {
|
||||
var o,
|
||||
i = t.getAttribute('data-language') || e[a.language] || ((o = a.language) ? (o.substring(0, 1).toUpperCase() + o.substring(1)).replace(/s(?=cript)/, 'S') : o);
|
||||
if (i) {
|
||||
var s = document.createElement('span');
|
||||
return s.textContent = i, s;
|
||||
}
|
||||
}
|
||||
}));
|
||||
} else console.warn('Show Languages plugin loaded before Toolbar plugin.');
|
||||
}();
|
||||
// Copy Button
|
||||
!function() {
|
||||
function t(t) {
|
||||
var e = document.createElement('textarea');
|
||||
e.value = t.getText(), e.style.top = '0', e.style.left = '0', e.style.position = 'fixed', document.body.appendChild(e), e.focus(), e.select();
|
||||
try {
|
||||
var o = document.execCommand('copy');
|
||||
setTimeout((function() {
|
||||
o ? t.success() : t.error();
|
||||
}), 1);
|
||||
} catch (e) {
|
||||
setTimeout((function() {
|
||||
t.error(e);
|
||||
}), 1);
|
||||
}
|
||||
document.body.removeChild(e);
|
||||
}
|
||||
|
||||
'undefined' != typeof Prism && 'undefined' != typeof document && (Prism.plugins.toolbar ? Prism.plugins.toolbar.registerButton('copy-to-clipboard', (function(e) {
|
||||
var o = e.element, n = function(t) {
|
||||
var e = {
|
||||
copy: 'Copy',
|
||||
'copy-error': 'Press Ctrl+C to copy',
|
||||
'copy-success': 'Copied!',
|
||||
'copy-timeout': 5e3,
|
||||
};
|
||||
for (var o in e) {
|
||||
for (var n = 'data-prismjs-' + o, c = t; c && !c.hasAttribute(n);) c = c.parentElement;
|
||||
c && (e[o] = c.getAttribute(n));
|
||||
}
|
||||
return e;
|
||||
}(o), c = document.createElement('button');
|
||||
c.className = 'copy-to-clipboard-button', c.setAttribute('type', 'button');
|
||||
var r = document.createElement('span');
|
||||
return c.appendChild(r), u('copy'), function(e, o) {
|
||||
e.addEventListener('click', (function() {
|
||||
!function(e) {
|
||||
navigator.clipboard ? navigator.clipboard.writeText(e.getText()).then(e.success, (function() {
|
||||
t(e);
|
||||
})) : t(e);
|
||||
}(o);
|
||||
}));
|
||||
}(c, {
|
||||
getText: function() {
|
||||
return o.textContent;
|
||||
}, success: function() {
|
||||
u('copy-success'), i();
|
||||
}, error: function() {
|
||||
u('copy-error'), setTimeout((function() {
|
||||
!function(t) {
|
||||
window.getSelection().selectAllChildren(t);
|
||||
}(o);
|
||||
}), 1), i();
|
||||
},
|
||||
}), c;
|
||||
|
||||
function i() {
|
||||
setTimeout((function() {
|
||||
u('copy');
|
||||
}), n['copy-timeout']);
|
||||
}
|
||||
|
||||
function u(t) {
|
||||
r.textContent = n[t], c.setAttribute('data-copy-state', t);
|
||||
}
|
||||
})) : console.warn('Copy to Clipboard plugin loaded before Toolbar plugin.'));
|
||||
}();
|
||||
// Line Numbers
|
||||
!function() {
|
||||
if ('undefined' != typeof Prism && 'undefined' != typeof document) {
|
||||
var e = 'line-numbers', n = /\n(?!$)/g, t = Prism.plugins.lineNumbers = {
|
||||
getLine: function(n, t) {
|
||||
if ('PRE' === n.tagName && n.classList.contains(e)) {
|
||||
var i = n.querySelector('.line-numbers-rows');
|
||||
if (i) {
|
||||
var r = parseInt(n.getAttribute('data-start'), 10) || 1, s = r + (i.children.length - 1);
|
||||
t < r && (t = r), t > s && (t = s);
|
||||
var l = t - r;
|
||||
return i.children[l];
|
||||
}
|
||||
}
|
||||
}, resize: function(e) {
|
||||
r([e]);
|
||||
}, assumeViewportIndependence: !0,
|
||||
}, i = void 0;
|
||||
window.addEventListener('resize', (function() {
|
||||
t.assumeViewportIndependence && i === window.innerWidth || (i = window.innerWidth, r(Array.prototype.slice.call(document.querySelectorAll('pre.line-numbers'))));
|
||||
})), Prism.hooks.add('complete', (function(t) {
|
||||
if (t.code) {
|
||||
var i = t.element, s = i.parentNode;
|
||||
if (s && /pre/i.test(s.nodeName) && !i.querySelector('.line-numbers-rows') && Prism.util.isActive(i, e)) {
|
||||
i.classList.remove(e), s.classList.add(e);
|
||||
var l, o = t.code.match(n), a = o ? o.length + 1 : 1, u = new Array(a + 1).join('<span></span>');
|
||||
(l = document.createElement('span')).setAttribute('aria-hidden', 'true'), l.className = 'line-numbers-rows', l.innerHTML = u, s.hasAttribute('data-start') && (s.style.counterReset = 'linenumber ' + (parseInt(s.getAttribute('data-start'), 10) - 1)), t.element.appendChild(l), r([s]), Prism.hooks.run('line-numbers', t);
|
||||
}
|
||||
}
|
||||
})), Prism.hooks.add('line-numbers', (function(e) {
|
||||
e.plugins = e.plugins || {}, e.plugins.lineNumbers = !0;
|
||||
}));
|
||||
}
|
||||
|
||||
function r(e) {
|
||||
if (0 != (e = e.filter((function(e) {
|
||||
var n,
|
||||
t = (n = e, n ? window.getComputedStyle ? getComputedStyle(n) : n.currentStyle || null : null)['white-space'];
|
||||
return 'pre-wrap' === t || 'pre-line' === t;
|
||||
}))).length) {
|
||||
var t = e.map((function(e) {
|
||||
var t = e.querySelector('code'), i = e.querySelector('.line-numbers-rows');
|
||||
if (t && i) {
|
||||
var r = e.querySelector('.line-numbers-sizer'), s = t.textContent.split(n);
|
||||
r || ((r = document.createElement('span')).className = 'line-numbers-sizer', t.appendChild(r)), r.innerHTML = '0', r.style.display = 'block';
|
||||
var l = r.getBoundingClientRect().height;
|
||||
return r.innerHTML = '', { element: e, lines: s, lineHeights: [], oneLinerHeight: l, sizer: r };
|
||||
}
|
||||
})).filter(Boolean);
|
||||
t.forEach((function(e) {
|
||||
var n = e.sizer, t = e.lines, i = e.lineHeights, r = e.oneLinerHeight;
|
||||
i[t.length - 1] = void 0, t.forEach((function(e, t) {
|
||||
if (e && e.length > 1) {
|
||||
var s = n.appendChild(document.createElement('span'));
|
||||
s.style.display = 'block', s.textContent = e;
|
||||
} else i[t] = r;
|
||||
}));
|
||||
})), t.forEach((function(e) {
|
||||
for (var n = e.sizer, t = e.lineHeights, i = 0, r = 0; r < t.length; r++) void 0 === t[r] && (t[r] = n.children[i++].getBoundingClientRect().height);
|
||||
})), t.forEach((function(e) {
|
||||
var n = e.sizer, t = e.element.querySelector('.line-numbers-rows');
|
||||
n.style.display = 'none', n.innerHTML = '', e.lineHeights.forEach((function(e, n) {
|
||||
t.children[n].style.height = e + 'px';
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
// Versions: 1.29.0
|
||||
// Toolbar
|
||||
!function() {
|
||||
if ('undefined' != typeof Prism && 'undefined' != typeof document) {
|
||||
var e = [], t = {}, n = function() {
|
||||
};
|
||||
Prism.plugins.toolbar = {};
|
||||
var a = Prism.plugins.toolbar.registerButton = function(n, a) {
|
||||
var r;
|
||||
r = 'function' == typeof a ? a : function(e) {
|
||||
var t;
|
||||
return 'function' == typeof a.onClick ? ((t = document.createElement('button')).type = 'button', t.addEventListener('click', (function() {
|
||||
a.onClick.call(this, e);
|
||||
}))) : 'string' == typeof a.url ? (t = document.createElement('a')).href = a.url : t = document.createElement('span'), a.className && t.classList.add(a.className), t.textContent = a.text, t;
|
||||
}, n in t ? console.warn('There is a button with the key "' + n + '" registered already.') : e.push(t[n] = r);
|
||||
}, r = Prism.plugins.toolbar.hook = function(a) {
|
||||
var r = a.element.parentNode;
|
||||
if (r && /pre/i.test(r.nodeName) && !r.parentNode.classList.contains('code-toolbar')) {
|
||||
var o = document.createElement('div');
|
||||
o.classList.add('code-toolbar'), r.parentNode.insertBefore(o, r), o.appendChild(r);
|
||||
var i = document.createElement('div');
|
||||
i.classList.add('toolbar');
|
||||
var l = e, d = function(e) {
|
||||
for (; e;) {
|
||||
var t = e.getAttribute('data-toolbar-order');
|
||||
if (null != t) return (t = t.trim()).length ? t.split(/\s*,\s*/g) : [];
|
||||
e = e.parentElement;
|
||||
}
|
||||
}(a.element);
|
||||
d && (l = d.map((function(e) {
|
||||
return t[e] || n;
|
||||
}))), l.forEach((function(e) {
|
||||
var t = e(a);
|
||||
if (t) {
|
||||
var n = document.createElement('div');
|
||||
n.classList.add('toolbar-item'), n.appendChild(t), i.appendChild(n);
|
||||
}
|
||||
})), o.appendChild(i);
|
||||
}
|
||||
};
|
||||
a('label', (function(e) {
|
||||
var t = e.element.parentNode;
|
||||
if (t && /pre/i.test(t.nodeName) && t.hasAttribute('data-label')) {
|
||||
var n, a, r = t.getAttribute('data-label');
|
||||
try {
|
||||
a = document.querySelector('template#' + r);
|
||||
} catch (e) {
|
||||
}
|
||||
return a ? n = a.content : (t.hasAttribute('data-url') ? (n = document.createElement('a')).href = t.getAttribute('data-url') : n = document.createElement('span'), n.textContent = r), n;
|
||||
}
|
||||
})), Prism.hooks.add('complete', r);
|
||||
}
|
||||
}();
|
||||
// Show Language
|
||||
!function() {
|
||||
if ('undefined' != typeof Prism && 'undefined' != typeof document) if (Prism.plugins.toolbar) {
|
||||
var e = {
|
||||
none: 'Plain text',
|
||||
plain: 'Plain text',
|
||||
plaintext: 'Plain text',
|
||||
text: 'Plain text',
|
||||
txt: 'Plain text',
|
||||
html: 'HTML',
|
||||
xml: 'XML',
|
||||
svg: 'SVG',
|
||||
mathml: 'MathML',
|
||||
ssml: 'SSML',
|
||||
rss: 'RSS',
|
||||
css: 'CSS',
|
||||
clike: 'C-like',
|
||||
js: 'JavaScript',
|
||||
abap: 'ABAP',
|
||||
abnf: 'ABNF',
|
||||
al: 'AL',
|
||||
antlr4: 'ANTLR4',
|
||||
g4: 'ANTLR4',
|
||||
apacheconf: 'Apache Configuration',
|
||||
apl: 'APL',
|
||||
aql: 'AQL',
|
||||
ino: 'Arduino',
|
||||
arff: 'ARFF',
|
||||
armasm: 'ARM Assembly',
|
||||
'arm-asm': 'ARM Assembly',
|
||||
art: 'Arturo',
|
||||
asciidoc: 'AsciiDoc',
|
||||
adoc: 'AsciiDoc',
|
||||
aspnet: 'ASP.NET (C#)',
|
||||
asm6502: '6502 Assembly',
|
||||
asmatmel: 'Atmel AVR Assembly',
|
||||
autohotkey: 'AutoHotkey',
|
||||
autoit: 'AutoIt',
|
||||
avisynth: 'AviSynth',
|
||||
avs: 'AviSynth',
|
||||
'avro-idl': 'Avro IDL',
|
||||
avdl: 'Avro IDL',
|
||||
awk: 'AWK',
|
||||
gawk: 'GAWK',
|
||||
sh: 'Shell',
|
||||
basic: 'BASIC',
|
||||
bbcode: 'BBcode',
|
||||
bbj: 'BBj',
|
||||
bnf: 'BNF',
|
||||
rbnf: 'RBNF',
|
||||
bqn: 'BQN',
|
||||
bsl: 'BSL (1C:Enterprise)',
|
||||
oscript: 'OneScript',
|
||||
csharp: 'C#',
|
||||
cs: 'C#',
|
||||
dotnet: 'C#',
|
||||
cpp: 'C++',
|
||||
cfscript: 'CFScript',
|
||||
cfc: 'CFScript',
|
||||
cil: 'CIL',
|
||||
cilkc: 'Cilk/C',
|
||||
'cilk-c': 'Cilk/C',
|
||||
cilkcpp: 'Cilk/C++',
|
||||
'cilk-cpp': 'Cilk/C++',
|
||||
cilk: 'Cilk/C++',
|
||||
cmake: 'CMake',
|
||||
cobol: 'COBOL',
|
||||
coffee: 'CoffeeScript',
|
||||
conc: 'Concurnas',
|
||||
csp: 'Content-Security-Policy',
|
||||
'css-extras': 'CSS Extras',
|
||||
csv: 'CSV',
|
||||
cue: 'CUE',
|
||||
dataweave: 'DataWeave',
|
||||
dax: 'DAX',
|
||||
django: 'Django/Jinja2',
|
||||
jinja2: 'Django/Jinja2',
|
||||
'dns-zone-file': 'DNS zone file',
|
||||
'dns-zone': 'DNS zone file',
|
||||
dockerfile: 'Docker',
|
||||
dot: 'DOT (Graphviz)',
|
||||
gv: 'DOT (Graphviz)',
|
||||
ebnf: 'EBNF',
|
||||
editorconfig: 'EditorConfig',
|
||||
ejs: 'EJS',
|
||||
etlua: 'Embedded Lua templating',
|
||||
erb: 'ERB',
|
||||
'excel-formula': 'Excel Formula',
|
||||
xlsx: 'Excel Formula',
|
||||
xls: 'Excel Formula',
|
||||
fsharp: 'F#',
|
||||
'firestore-security-rules': 'Firestore security rules',
|
||||
ftl: 'FreeMarker Template Language',
|
||||
gml: 'GameMaker Language',
|
||||
gamemakerlanguage: 'GameMaker Language',
|
||||
gap: 'GAP (CAS)',
|
||||
gcode: 'G-code',
|
||||
gdscript: 'GDScript',
|
||||
gedcom: 'GEDCOM',
|
||||
gettext: 'gettext',
|
||||
po: 'gettext',
|
||||
glsl: 'GLSL',
|
||||
gn: 'GN',
|
||||
gni: 'GN',
|
||||
'linker-script': 'GNU Linker Script',
|
||||
ld: 'GNU Linker Script',
|
||||
'go-module': 'Go module',
|
||||
'go-mod': 'Go module',
|
||||
graphql: 'GraphQL',
|
||||
hbs: 'Handlebars',
|
||||
hs: 'Haskell',
|
||||
hcl: 'HCL',
|
||||
hlsl: 'HLSL',
|
||||
http: 'HTTP',
|
||||
hpkp: 'HTTP Public-Key-Pins',
|
||||
hsts: 'HTTP Strict-Transport-Security',
|
||||
ichigojam: 'IchigoJam',
|
||||
'icu-message-format': 'ICU Message Format',
|
||||
idr: 'Idris',
|
||||
ignore: '.ignore',
|
||||
gitignore: '.gitignore',
|
||||
hgignore: '.hgignore',
|
||||
npmignore: '.npmignore',
|
||||
inform7: 'Inform 7',
|
||||
javadoc: 'JavaDoc',
|
||||
javadoclike: 'JavaDoc-like',
|
||||
javastacktrace: 'Java stack trace',
|
||||
jq: 'JQ',
|
||||
jsdoc: 'JSDoc',
|
||||
'js-extras': 'JS Extras',
|
||||
json: 'JSON',
|
||||
webmanifest: 'Web App Manifest',
|
||||
json5: 'JSON5',
|
||||
jsonp: 'JSONP',
|
||||
jsstacktrace: 'JS stack trace',
|
||||
'js-templates': 'JS Templates',
|
||||
keepalived: 'Keepalived Configure',
|
||||
kts: 'Kotlin Script',
|
||||
kt: 'Kotlin',
|
||||
kumir: 'KuMir (КуМир)',
|
||||
kum: 'KuMir (КуМир)',
|
||||
latex: 'LaTeX',
|
||||
tex: 'TeX',
|
||||
context: 'ConTeXt',
|
||||
lilypond: 'LilyPond',
|
||||
ly: 'LilyPond',
|
||||
emacs: 'Lisp',
|
||||
elisp: 'Lisp',
|
||||
'emacs-lisp': 'Lisp',
|
||||
llvm: 'LLVM IR',
|
||||
log: 'Log file',
|
||||
lolcode: 'LOLCODE',
|
||||
magma: 'Magma (CAS)',
|
||||
md: 'Markdown',
|
||||
'markup-templating': 'Markup templating',
|
||||
matlab: 'MATLAB',
|
||||
maxscript: 'MAXScript',
|
||||
mel: 'MEL',
|
||||
metafont: 'METAFONT',
|
||||
mongodb: 'MongoDB',
|
||||
moon: 'MoonScript',
|
||||
n1ql: 'N1QL',
|
||||
n4js: 'N4JS',
|
||||
n4jsd: 'N4JS',
|
||||
'nand2tetris-hdl': 'Nand To Tetris HDL',
|
||||
naniscript: 'Naninovel Script',
|
||||
nani: 'Naninovel Script',
|
||||
nasm: 'NASM',
|
||||
neon: 'NEON',
|
||||
nginx: 'nginx',
|
||||
nsis: 'NSIS',
|
||||
objectivec: 'Objective-C',
|
||||
objc: 'Objective-C',
|
||||
ocaml: 'OCaml',
|
||||
opencl: 'OpenCL',
|
||||
openqasm: 'OpenQasm',
|
||||
qasm: 'OpenQasm',
|
||||
parigp: 'PARI/GP',
|
||||
objectpascal: 'Object Pascal',
|
||||
psl: 'PATROL Scripting Language',
|
||||
pcaxis: 'PC-Axis',
|
||||
px: 'PC-Axis',
|
||||
peoplecode: 'PeopleCode',
|
||||
pcode: 'PeopleCode',
|
||||
php: 'PHP',
|
||||
phpdoc: 'PHPDoc',
|
||||
'php-extras': 'PHP Extras',
|
||||
'plant-uml': 'PlantUML',
|
||||
plantuml: 'PlantUML',
|
||||
plsql: 'PL/SQL',
|
||||
powerquery: 'PowerQuery',
|
||||
pq: 'PowerQuery',
|
||||
mscript: 'PowerQuery',
|
||||
powershell: 'PowerShell',
|
||||
promql: 'PromQL',
|
||||
properties: '.properties',
|
||||
protobuf: 'Protocol Buffers',
|
||||
purebasic: 'PureBasic',
|
||||
pbfasm: 'PureBasic',
|
||||
purs: 'PureScript',
|
||||
py: 'Python',
|
||||
qsharp: 'Q#',
|
||||
qs: 'Q#',
|
||||
q: 'Q (kdb+ database)',
|
||||
qml: 'QML',
|
||||
rkt: 'Racket',
|
||||
cshtml: 'Razor C#',
|
||||
razor: 'Razor C#',
|
||||
jsx: 'React JSX',
|
||||
tsx: 'React TSX',
|
||||
renpy: 'Ren\'py',
|
||||
rpy: 'Ren\'py',
|
||||
res: 'ReScript',
|
||||
rest: 'reST (reStructuredText)',
|
||||
robotframework: 'Robot Framework',
|
||||
robot: 'Robot Framework',
|
||||
rb: 'Ruby',
|
||||
sas: 'SAS',
|
||||
sass: 'Sass (Sass)',
|
||||
scss: 'Sass (SCSS)',
|
||||
'shell-session': 'Shell session',
|
||||
'sh-session': 'Shell session',
|
||||
shellsession: 'Shell session',
|
||||
sml: 'SML',
|
||||
smlnj: 'SML/NJ',
|
||||
solidity: 'Solidity (Ethereum)',
|
||||
sol: 'Solidity (Ethereum)',
|
||||
'solution-file': 'Solution file',
|
||||
sln: 'Solution file',
|
||||
soy: 'Soy (Closure Template)',
|
||||
sparql: 'SPARQL',
|
||||
rq: 'SPARQL',
|
||||
'splunk-spl': 'Splunk SPL',
|
||||
sqf: 'SQF: Status Quo Function (Arma 3)',
|
||||
sql: 'SQL',
|
||||
stata: 'Stata Ado',
|
||||
iecst: 'Structured Text (IEC 61131-3)',
|
||||
supercollider: 'SuperCollider',
|
||||
sclang: 'SuperCollider',
|
||||
systemd: 'Systemd configuration file',
|
||||
't4-templating': 'T4 templating',
|
||||
't4-cs': 'T4 Text Templates (C#)',
|
||||
t4: 'T4 Text Templates (C#)',
|
||||
't4-vb': 'T4 Text Templates (VB)',
|
||||
tap: 'TAP',
|
||||
tt2: 'Template Toolkit 2',
|
||||
toml: 'TOML',
|
||||
trickle: 'trickle',
|
||||
troy: 'troy',
|
||||
trig: 'TriG',
|
||||
ts: 'TypeScript',
|
||||
tsconfig: 'TSConfig',
|
||||
uscript: 'UnrealScript',
|
||||
uc: 'UnrealScript',
|
||||
uorazor: 'UO Razor Script',
|
||||
uri: 'URI',
|
||||
url: 'URL',
|
||||
vbnet: 'VB.Net',
|
||||
vhdl: 'VHDL',
|
||||
vim: 'vim',
|
||||
'visual-basic': 'Visual Basic',
|
||||
vba: 'VBA',
|
||||
vb: 'Visual Basic',
|
||||
wasm: 'WebAssembly',
|
||||
'web-idl': 'Web IDL',
|
||||
webidl: 'Web IDL',
|
||||
wgsl: 'WGSL',
|
||||
wiki: 'Wiki markup',
|
||||
wolfram: 'Wolfram language',
|
||||
nb: 'Mathematica Notebook',
|
||||
wl: 'Wolfram language',
|
||||
xeoracube: 'XeoraCube',
|
||||
'xml-doc': 'XML doc (.net)',
|
||||
xojo: 'Xojo (REALbasic)',
|
||||
xquery: 'XQuery',
|
||||
yaml: 'YAML',
|
||||
yml: 'YAML',
|
||||
yang: 'YANG',
|
||||
};
|
||||
Prism.plugins.toolbar.registerButton('show-language', (function(a) {
|
||||
var t = a.element.parentNode;
|
||||
if (t && /pre/i.test(t.nodeName)) {
|
||||
var o,
|
||||
i = t.getAttribute('data-language') || e[a.language] || ((o = a.language) ? (o.substring(0, 1).toUpperCase() + o.substring(1)).replace(/s(?=cript)/, 'S') : o);
|
||||
if (i) {
|
||||
var s = document.createElement('span');
|
||||
return s.textContent = i, s;
|
||||
}
|
||||
}
|
||||
}));
|
||||
} else console.warn('Show Languages plugin loaded before Toolbar plugin.');
|
||||
}();
|
||||
// Copy Button
|
||||
!function() {
|
||||
function t(t) {
|
||||
var e = document.createElement('textarea');
|
||||
e.value = t.getText(), e.style.top = '0', e.style.left = '0', e.style.position = 'fixed', document.body.appendChild(e), e.focus(), e.select();
|
||||
try {
|
||||
var o = document.execCommand('copy');
|
||||
setTimeout((function() {
|
||||
o ? t.success() : t.error();
|
||||
}), 1);
|
||||
} catch (e) {
|
||||
setTimeout((function() {
|
||||
t.error(e);
|
||||
}), 1);
|
||||
}
|
||||
document.body.removeChild(e);
|
||||
}
|
||||
|
||||
'undefined' != typeof Prism && 'undefined' != typeof document && (Prism.plugins.toolbar ? Prism.plugins.toolbar.registerButton('copy-to-clipboard', (function(e) {
|
||||
var o = e.element, n = function(t) {
|
||||
var e = {
|
||||
copy: 'Copy',
|
||||
'copy-error': 'Press Ctrl+C to copy',
|
||||
'copy-success': 'Copied!',
|
||||
'copy-timeout': 5e3,
|
||||
};
|
||||
for (var o in e) {
|
||||
for (var n = 'data-prismjs-' + o, c = t; c && !c.hasAttribute(n);) c = c.parentElement;
|
||||
c && (e[o] = c.getAttribute(n));
|
||||
}
|
||||
return e;
|
||||
}(o), c = document.createElement('button');
|
||||
c.className = 'copy-to-clipboard-button', c.setAttribute('type', 'button');
|
||||
var r = document.createElement('span');
|
||||
return c.appendChild(r), u('copy'), function(e, o) {
|
||||
e.addEventListener('click', (function() {
|
||||
!function(e) {
|
||||
navigator.clipboard ? navigator.clipboard.writeText(e.getText()).then(e.success, (function() {
|
||||
t(e);
|
||||
})) : t(e);
|
||||
}(o);
|
||||
}));
|
||||
}(c, {
|
||||
getText: function() {
|
||||
return o.textContent;
|
||||
}, success: function() {
|
||||
u('copy-success'), i();
|
||||
}, error: function() {
|
||||
u('copy-error'), setTimeout((function() {
|
||||
!function(t) {
|
||||
window.getSelection().selectAllChildren(t);
|
||||
}(o);
|
||||
}), 1), i();
|
||||
},
|
||||
}), c;
|
||||
|
||||
function i() {
|
||||
setTimeout((function() {
|
||||
u('copy');
|
||||
}), n['copy-timeout']);
|
||||
}
|
||||
|
||||
function u(t) {
|
||||
r.textContent = n[t], c.setAttribute('data-copy-state', t);
|
||||
}
|
||||
})) : console.warn('Copy to Clipboard plugin loaded before Toolbar plugin.'));
|
||||
}();
|
||||
// Line Numbers
|
||||
!function() {
|
||||
if ('undefined' != typeof Prism && 'undefined' != typeof document) {
|
||||
var e = 'line-numbers', n = /\n(?!$)/g, t = Prism.plugins.lineNumbers = {
|
||||
getLine: function(n, t) {
|
||||
if ('PRE' === n.tagName && n.classList.contains(e)) {
|
||||
var i = n.querySelector('.line-numbers-rows');
|
||||
if (i) {
|
||||
var r = parseInt(n.getAttribute('data-start'), 10) || 1, s = r + (i.children.length - 1);
|
||||
t < r && (t = r), t > s && (t = s);
|
||||
var l = t - r;
|
||||
return i.children[l];
|
||||
}
|
||||
}
|
||||
}, resize: function(e) {
|
||||
r([e]);
|
||||
}, assumeViewportIndependence: !0,
|
||||
}, i = void 0;
|
||||
window.addEventListener('resize', (function() {
|
||||
t.assumeViewportIndependence && i === window.innerWidth || (i = window.innerWidth, r(Array.prototype.slice.call(document.querySelectorAll('pre.line-numbers'))));
|
||||
})), Prism.hooks.add('complete', (function(t) {
|
||||
if (t.code) {
|
||||
var i = t.element, s = i.parentNode;
|
||||
if (s && /pre/i.test(s.nodeName) && !i.querySelector('.line-numbers-rows') && Prism.util.isActive(i, e)) {
|
||||
i.classList.remove(e), s.classList.add(e);
|
||||
var l, o = t.code.match(n), a = o ? o.length + 1 : 1, u = new Array(a + 1).join('<span></span>');
|
||||
(l = document.createElement('span')).setAttribute('aria-hidden', 'true'), l.className = 'line-numbers-rows', l.innerHTML = u, s.hasAttribute('data-start') && (s.style.counterReset = 'linenumber ' + (parseInt(s.getAttribute('data-start'), 10) - 1)), t.element.appendChild(l), r([s]), Prism.hooks.run('line-numbers', t);
|
||||
}
|
||||
}
|
||||
})), Prism.hooks.add('line-numbers', (function(e) {
|
||||
e.plugins = e.plugins || {}, e.plugins.lineNumbers = !0;
|
||||
}));
|
||||
}
|
||||
|
||||
function r(e) {
|
||||
if (0 != (e = e.filter((function(e) {
|
||||
var n,
|
||||
t = (n = e, n ? window.getComputedStyle ? getComputedStyle(n) : n.currentStyle || null : null)['white-space'];
|
||||
return 'pre-wrap' === t || 'pre-line' === t;
|
||||
}))).length) {
|
||||
var t = e.map((function(e) {
|
||||
var t = e.querySelector('code'), i = e.querySelector('.line-numbers-rows');
|
||||
if (t && i) {
|
||||
var r = e.querySelector('.line-numbers-sizer'), s = t.textContent.split(n);
|
||||
r || ((r = document.createElement('span')).className = 'line-numbers-sizer', t.appendChild(r)), r.innerHTML = '0', r.style.display = 'block';
|
||||
var l = r.getBoundingClientRect().height;
|
||||
return r.innerHTML = '', { element: e, lines: s, lineHeights: [], oneLinerHeight: l, sizer: r };
|
||||
}
|
||||
})).filter(Boolean);
|
||||
t.forEach((function(e) {
|
||||
var n = e.sizer, t = e.lines, i = e.lineHeights, r = e.oneLinerHeight;
|
||||
i[t.length - 1] = void 0, t.forEach((function(e, t) {
|
||||
if (e && e.length > 1) {
|
||||
var s = n.appendChild(document.createElement('span'));
|
||||
s.style.display = 'block', s.textContent = e;
|
||||
} else i[t] = r;
|
||||
}));
|
||||
})), t.forEach((function(e) {
|
||||
for (var n = e.sizer, t = e.lineHeights, i = 0, r = 0; r < t.length; r++) void 0 === t[r] && (t[r] = n.children[i++].getBoundingClientRect().height);
|
||||
})), t.forEach((function(e) {
|
||||
var n = e.sizer, t = e.element.querySelector('.line-numbers-rows');
|
||||
n.style.display = 'none', n.innerHTML = '', e.lineHeights.forEach((function(e, n) {
|
||||
t.children[n].style.height = e + 'px';
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
}();
|
Loading…
x
Reference in New Issue
Block a user