单独引入插件包,可以做到单独控制

This commit is contained in:
liuzhihang 2022-10-18 22:12:29 +08:00
parent 963bd9ca46
commit 312797d68f
31 changed files with 1375 additions and 16726 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,11 @@
## 说明
本 libs 中的依赖完全来自于 github 仓库。
https://github.com/PrismJS/prism
## 主题
主题部分来自于扩展仓库
https://github.com/PrismJS/prism-themes

View File

@ -0,0 +1,163 @@
(function () {
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
return;
}
if (!Prism.plugins.toolbar) {
console.warn('Copy to Clipboard plugin loaded before Toolbar plugin.');
return;
}
/**
* When the given elements is clicked by the user, the given text will be copied to clipboard.
*
* @param {HTMLElement} element
* @param {CopyInfo} copyInfo
*
* @typedef CopyInfo
* @property {() => string} getText
* @property {() => void} success
* @property {(reason: unknown) => void} error
*/
function registerClipboard(element, copyInfo) {
element.addEventListener('click', function () {
copyTextToClipboard(copyInfo);
});
}
// https://stackoverflow.com/a/30810322/7595472
/** @param {CopyInfo} copyInfo */
function fallbackCopyTextToClipboard(copyInfo) {
var textArea = document.createElement('textarea');
textArea.value = copyInfo.getText();
// Avoid scrolling to bottom
textArea.style.top = '0';
textArea.style.left = '0';
textArea.style.position = 'fixed';
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
setTimeout(function () {
if (successful) {
copyInfo.success();
} else {
copyInfo.error();
}
}, 1);
} catch (err) {
setTimeout(function () {
copyInfo.error(err);
}, 1);
}
document.body.removeChild(textArea);
}
/** @param {CopyInfo} copyInfo */
function copyTextToClipboard(copyInfo) {
if (navigator.clipboard) {
navigator.clipboard.writeText(copyInfo.getText()).then(copyInfo.success, function () {
// try the fallback in case `writeText` didn't work
fallbackCopyTextToClipboard(copyInfo);
});
} else {
fallbackCopyTextToClipboard(copyInfo);
}
}
/**
* Selects the text content of the given element.
*
* @param {Element} element
*/
function selectElementText(element) {
// https://stackoverflow.com/a/20079910/7595472
window.getSelection().selectAllChildren(element);
}
/**
* Traverses up the DOM tree to find data attributes that override the default plugin settings.
*
* @param {Element} startElement An element to start from.
* @returns {Settings} The plugin settings.
* @typedef {Record<"copy" | "copy-error" | "copy-success" | "copy-timeout", string | number>} Settings
*/
function getSettings(startElement) {
/** @type {Settings} */
var settings = {
'copy': 'Copy',
'copy-error': 'Press Ctrl+C to copy',
'copy-success': 'Copied!',
'copy-timeout': 5000
};
var prefix = 'data-prismjs-';
for (var key in settings) {
var attr = prefix + key;
var element = startElement;
while (element && !element.hasAttribute(attr)) {
element = element.parentElement;
}
if (element) {
settings[key] = element.getAttribute(attr);
}
}
return settings;
}
Prism.plugins.toolbar.registerButton('copy-to-clipboard', function (env) {
var element = env.element;
var settings = getSettings(element);
var linkCopy = document.createElement('button');
linkCopy.className = 'copy-to-clipboard-button';
linkCopy.setAttribute('type', 'button');
var linkSpan = document.createElement('span');
linkCopy.appendChild(linkSpan);
setState('copy');
registerClipboard(linkCopy, {
getText: function () {
return element.textContent;
},
success: function () {
setState('copy-success');
resetText();
},
error: function () {
setState('copy-error');
setTimeout(function () {
selectElementText(element);
}, 1);
resetText();
}
});
return linkCopy;
function resetText() {
setTimeout(function () {
setState('copy');
}, settings['copy-timeout']);
}
/** @param {"copy" | "copy-error" | "copy-success"} state */
function setState(state) {
linkSpan.textContent = settings[state];
linkCopy.setAttribute('data-copy-state', state);
}
});
}());

View File

@ -0,0 +1 @@
!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."))}();

View File

@ -0,0 +1,40 @@
pre[class*="language-"].line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}
pre[class*="language-"].line-numbers > code {
position: relative;
white-space: inherit;
}
.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: -3.8em;
width: 3em; /* works for line-numbers below 1000 lines */
letter-spacing: -1px;
border-right: 1px solid #999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.line-numbers-rows > span {
display: block;
counter-increment: linenumber;
}
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: block;
padding-right: 0.8em;
text-align: right;
}

View File

@ -0,0 +1,252 @@
(function () {
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
return;
}
/**
* Plugin name which is used as a class name for <pre> which is activating the plugin
*
* @type {string}
*/
var PLUGIN_NAME = 'line-numbers';
/**
* Regular expression used for determining line breaks
*
* @type {RegExp}
*/
var NEW_LINE_EXP = /\n(?!$)/g;
/**
* Global exports
*/
var config = Prism.plugins.lineNumbers = {
/**
* Get node for provided line number
*
* @param {Element} element pre element
* @param {number} number line number
* @returns {Element|undefined}
*/
getLine: function (element, number) {
if (element.tagName !== 'PRE' || !element.classList.contains(PLUGIN_NAME)) {
return;
}
var lineNumberRows = element.querySelector('.line-numbers-rows');
if (!lineNumberRows) {
return;
}
var lineNumberStart = parseInt(element.getAttribute('data-start'), 10) || 1;
var lineNumberEnd = lineNumberStart + (lineNumberRows.children.length - 1);
if (number < lineNumberStart) {
number = lineNumberStart;
}
if (number > lineNumberEnd) {
number = lineNumberEnd;
}
var lineIndex = number - lineNumberStart;
return lineNumberRows.children[lineIndex];
},
/**
* Resizes the line numbers of the given element.
*
* This function will not add line numbers. It will only resize existing ones.
*
* @param {HTMLElement} element A `<pre>` element with line numbers.
* @returns {void}
*/
resize: function (element) {
resizeElements([element]);
},
/**
* Whether the plugin can assume that the units font sizes and margins are not depended on the size of
* the current viewport.
*
* Setting this to `true` will allow the plugin to do certain optimizations for better performance.
*
* Set this to `false` if you use any of the following CSS units: `vh`, `vw`, `vmin`, `vmax`.
*
* @type {boolean}
*/
assumeViewportIndependence: true
};
/**
* Resizes the given elements.
*
* @param {HTMLElement[]} elements
*/
function resizeElements(elements) {
elements = elements.filter(function (e) {
var codeStyles = getStyles(e);
var whiteSpace = codeStyles['white-space'];
return whiteSpace === 'pre-wrap' || whiteSpace === 'pre-line';
});
if (elements.length == 0) {
return;
}
var infos = elements.map(function (element) {
var codeElement = element.querySelector('code');
var lineNumbersWrapper = element.querySelector('.line-numbers-rows');
if (!codeElement || !lineNumbersWrapper) {
return undefined;
}
/** @type {HTMLElement} */
var lineNumberSizer = element.querySelector('.line-numbers-sizer');
var codeLines = codeElement.textContent.split(NEW_LINE_EXP);
if (!lineNumberSizer) {
lineNumberSizer = document.createElement('span');
lineNumberSizer.className = 'line-numbers-sizer';
codeElement.appendChild(lineNumberSizer);
}
lineNumberSizer.innerHTML = '0';
lineNumberSizer.style.display = 'block';
var oneLinerHeight = lineNumberSizer.getBoundingClientRect().height;
lineNumberSizer.innerHTML = '';
return {
element: element,
lines: codeLines,
lineHeights: [],
oneLinerHeight: oneLinerHeight,
sizer: lineNumberSizer,
};
}).filter(Boolean);
infos.forEach(function (info) {
var lineNumberSizer = info.sizer;
var lines = info.lines;
var lineHeights = info.lineHeights;
var oneLinerHeight = info.oneLinerHeight;
lineHeights[lines.length - 1] = undefined;
lines.forEach(function (line, index) {
if (line && line.length > 1) {
var e = lineNumberSizer.appendChild(document.createElement('span'));
e.style.display = 'block';
e.textContent = line;
} else {
lineHeights[index] = oneLinerHeight;
}
});
});
infos.forEach(function (info) {
var lineNumberSizer = info.sizer;
var lineHeights = info.lineHeights;
var childIndex = 0;
for (var i = 0; i < lineHeights.length; i++) {
if (lineHeights[i] === undefined) {
lineHeights[i] = lineNumberSizer.children[childIndex++].getBoundingClientRect().height;
}
}
});
infos.forEach(function (info) {
var lineNumberSizer = info.sizer;
var wrapper = info.element.querySelector('.line-numbers-rows');
lineNumberSizer.style.display = 'none';
lineNumberSizer.innerHTML = '';
info.lineHeights.forEach(function (height, lineNumber) {
wrapper.children[lineNumber].style.height = height + 'px';
});
});
}
/**
* Returns style declarations for the element
*
* @param {Element} element
*/
function getStyles(element) {
if (!element) {
return null;
}
return window.getComputedStyle ? getComputedStyle(element) : (element.currentStyle || null);
}
var lastWidth = undefined;
window.addEventListener('resize', function () {
if (config.assumeViewportIndependence && lastWidth === window.innerWidth) {
return;
}
lastWidth = window.innerWidth;
resizeElements(Array.prototype.slice.call(document.querySelectorAll('pre.' + PLUGIN_NAME)));
});
Prism.hooks.add('complete', function (env) {
if (!env.code) {
return;
}
var code = /** @type {Element} */ (env.element);
var pre = /** @type {HTMLElement} */ (code.parentNode);
// works only for <code> wrapped inside <pre> (not inline)
if (!pre || !/pre/i.test(pre.nodeName)) {
return;
}
// Abort if line numbers already exists
if (code.querySelector('.line-numbers-rows')) {
return;
}
// only add line numbers if <code> or one of its ancestors has the `line-numbers` class
if (!Prism.util.isActive(code, PLUGIN_NAME)) {
return;
}
// Remove the class 'line-numbers' from the <code>
code.classList.remove(PLUGIN_NAME);
// Add the class 'line-numbers' to the <pre>
pre.classList.add(PLUGIN_NAME);
var match = env.code.match(NEW_LINE_EXP);
var linesNum = match ? match.length + 1 : 1;
var lineNumbersWrapper;
var lines = new Array(linesNum + 1).join('<span></span>');
lineNumbersWrapper = document.createElement('span');
lineNumbersWrapper.setAttribute('aria-hidden', 'true');
lineNumbersWrapper.className = 'line-numbers-rows';
lineNumbersWrapper.innerHTML = lines;
if (pre.hasAttribute('data-start')) {
pre.style.counterReset = 'linenumber ' + (parseInt(pre.getAttribute('data-start'), 10) - 1);
}
env.element.appendChild(lineNumbersWrapper);
resizeElements([pre]);
Prism.hooks.run('line-numbers', env);
});
Prism.hooks.add('line-numbers', function (env) {
env.plugins = env.plugins || {};
env.plugins.lineNumbers = true;
});
}());

View File

@ -0,0 +1 @@
pre[class*=language-].line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}

View File

@ -0,0 +1 @@
!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"}))}))}}}();

View File

@ -0,0 +1,325 @@
(function () {
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
return;
}
if (!Prism.plugins.toolbar) {
console.warn('Show Languages plugin loaded before Toolbar plugin.');
return;
}
/* eslint-disable */
// The languages map is built automatically with gulp
var Languages = /*languages_placeholder[*/{
"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"
}/*]*/;
/* eslint-enable */
Prism.plugins.toolbar.registerButton('show-language', function (env) {
var pre = env.element.parentNode;
if (!pre || !/pre/i.test(pre.nodeName)) {
return;
}
/**
* Tries to guess the name of a language given its id.
*
* @param {string} id The language id.
* @returns {string}
*/
function guessTitle(id) {
if (!id) {
return id;
}
return (id.substring(0, 1).toUpperCase() + id.substring(1)).replace(/s(?=cript)/, 'S');
}
var language = pre.getAttribute('data-language') || Languages[env.language] || guessTitle(env.language);
if (!language) {
return;
}
var element = document.createElement('span');
element.textContent = language;
return element;
});
}());

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,65 @@
div.code-toolbar {
position: relative;
}
div.code-toolbar > .toolbar {
position: absolute;
z-index: 10;
top: .3em;
right: .2em;
transition: opacity 0.3s ease-in-out;
opacity: 0;
}
div.code-toolbar:hover > .toolbar {
opacity: 1;
}
/* Separate line b/c rules are thrown out if selector is invalid.
IE11 and old Edge versions don't support :focus-within. */
div.code-toolbar:focus-within > .toolbar {
opacity: 1;
}
div.code-toolbar > .toolbar > .toolbar-item {
display: inline-block;
}
div.code-toolbar > .toolbar > .toolbar-item > a {
cursor: pointer;
}
div.code-toolbar > .toolbar > .toolbar-item > button {
background: none;
border: 0;
color: inherit;
font: inherit;
line-height: normal;
overflow: visible;
padding: 0;
-webkit-user-select: none; /* for button */
-moz-user-select: none;
-ms-user-select: none;
}
div.code-toolbar > .toolbar > .toolbar-item > a,
div.code-toolbar > .toolbar > .toolbar-item > button,
div.code-toolbar > .toolbar > .toolbar-item > span {
color: #bbb;
font-size: .8em;
padding: 0 .5em;
background: #f5f2f0;
background: rgba(224, 224, 224, 0.2);
box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.2);
border-radius: .5em;
}
div.code-toolbar > .toolbar > .toolbar-item > a:hover,
div.code-toolbar > .toolbar > .toolbar-item > a:focus,
div.code-toolbar > .toolbar > .toolbar-item > button:hover,
div.code-toolbar > .toolbar > .toolbar-item > button:focus,
div.code-toolbar > .toolbar > .toolbar-item > span:hover,
div.code-toolbar > .toolbar > .toolbar-item > span:focus {
color: inherit;
text-decoration: none;
}

View File

@ -0,0 +1,182 @@
(function () {
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
return;
}
var callbacks = [];
var map = {};
var noop = function () {
};
Prism.plugins.toolbar = {};
/**
* @typedef ButtonOptions
* @property {string} text The text displayed.
* @property {string} [url] The URL of the link which will be created.
* @property {Function} [onClick] The event listener for the `click` event of the created button.
* @property {string} [className] The class attribute to include with element.
*/
/**
* Register a button callback with the toolbar.
*
* @param {string} key
* @param {ButtonOptions|Function} opts
*/
var registerButton = Prism.plugins.toolbar.registerButton = function (key, opts) {
var callback;
if (typeof opts === 'function') {
callback = opts;
} else {
callback = function (env) {
var element;
if (typeof opts.onClick === 'function') {
element = document.createElement('button');
element.type = 'button';
element.addEventListener('click', function () {
opts.onClick.call(this, env);
});
} else if (typeof opts.url === 'string') {
element = document.createElement('a');
element.href = opts.url;
} else {
element = document.createElement('span');
}
if (opts.className) {
element.classList.add(opts.className);
}
element.textContent = opts.text;
return element;
};
}
if (key in map) {
console.warn('There is a button with the key "' + key + '" registered already.');
return;
}
callbacks.push(map[key] = callback);
};
/**
* Returns the callback order of the given element.
*
* @param {HTMLElement} element
* @returns {string[] | undefined}
*/
function getOrder(element) {
while (element) {
var order = element.getAttribute('data-toolbar-order');
if (order != null) {
order = order.trim();
if (order.length) {
return order.split(/\s*,\s*/g);
} else {
return [];
}
}
element = element.parentElement;
}
}
/**
* Post-highlight Prism hook callback.
*
* @param env
*/
var hook = Prism.plugins.toolbar.hook = function (env) {
// Check if inline or actual code block (credit to line-numbers plugin)
var pre = env.element.parentNode;
if (!pre || !/pre/i.test(pre.nodeName)) {
return;
}
// Autoloader rehighlights, so only do this once.
if (pre.parentNode.classList.contains('code-toolbar')) {
return;
}
// Create wrapper for <pre> to prevent scrolling toolbar with content
var wrapper = document.createElement('div');
wrapper.classList.add('code-toolbar');
pre.parentNode.insertBefore(wrapper, pre);
wrapper.appendChild(pre);
// Setup the toolbar
var toolbar = document.createElement('div');
toolbar.classList.add('toolbar');
// order callbacks
var elementCallbacks = callbacks;
var order = getOrder(env.element);
if (order) {
elementCallbacks = order.map(function (key) {
return map[key] || noop;
});
}
elementCallbacks.forEach(function (callback) {
var element = callback(env);
if (!element) {
return;
}
var item = document.createElement('div');
item.classList.add('toolbar-item');
item.appendChild(element);
toolbar.appendChild(item);
});
// Add our toolbar to the currently created wrapper of <pre> tag
wrapper.appendChild(toolbar);
};
registerButton('label', function (env) {
var pre = env.element.parentNode;
if (!pre || !/pre/i.test(pre.nodeName)) {
return;
}
if (!pre.hasAttribute('data-label')) {
return;
}
var element;
var template;
var text = pre.getAttribute('data-label');
try {
// Any normal text will blow up this selector.
template = document.querySelector('template#' + text);
} catch (e) { /* noop */
}
if (template) {
element = template.content;
} else {
if (pre.hasAttribute('data-url')) {
element = document.createElement('a');
element.href = pre.getAttribute('data-url');
} else {
element = document.createElement('span');
}
element.textContent = text;
}
return element;
});
/**
* Register the toolbar with Prism.
*/
Prism.hooks.add('complete', hook);
}());

View File

@ -0,0 +1 @@
div.code-toolbar{position:relative}div.code-toolbar>.toolbar{position:absolute;z-index:10;top:.3em;right:.2em;transition:opacity .3s ease-in-out;opacity:0}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{color:#bbb;font-size:.8em;padding:0 .5em;background:#f5f2f0;background:rgba(224,224,224,.2);box-shadow:0 2px 0 0 rgba(0,0,0,.2);border-radius:.5em}div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover{color:inherit;text-decoration:none}

View File

@ -0,0 +1 @@
!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)}}();

File diff suppressed because one or more lines are too long

View File

@ -1,9 +0,0 @@
/**
* Autolinker plugin overrides
* https://prismjs.com/plugins/autolinker
*/
/* Link in the code */
.token.token a {
color: unset; /* default: inherit */
}

View File

@ -1,14 +0,0 @@
/**
* Command Line plugin overrides
* https://prismjs.com/plugins/command-line
*/
/* Line separating gutter from coding area */
.command-line .command-line-prompt {
border-right-color: unset;
}
/* User details or whatever in the gutter */
.command-line .command-line-prompt > span:before {
color: unset;
}

View File

@ -1,46 +0,0 @@
/**
* Diff Highlight plugin overrides
* https://prismjs.com/plugins/diff-highlight
*/
/* Deleted lines */
pre.diff-highlight > code .token.token.deleted:not(.prefix),
pre > code.diff-highlight .token.token.deleted:not(.prefix) {
background-color: unset;
}
/* Deleted lines on highlight */
pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection,
pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection,
pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection,
pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection {
background-color: unset;
}
pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection,
pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection,
pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection,
pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection {
background-color: unset;
}
/* Inserted lines */
pre.diff-highlight > code .token.token.inserted:not(.prefix),
pre > code.diff-highlight .token.token.inserted:not(.prefix) {
background-color: unset;
}
/* Inserted lines on highlight */
pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection,
pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection,
pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection,
pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection {
background-color: unset;
}
pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection,
pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection,
pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection,
pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection {
background-color: unset;
}

View File

@ -1,26 +0,0 @@
/**
* Line Highlight plugin overrides
* https://prismjs.com/plugins/line-highlight
* This is the most popular plugin
*/
/* The highlighted line itself */
.line-highlight.line-highlight {
background: unset;
}
/* Default line numbers in Line Highlight plugin */
.line-highlight.line-highlight:before,
.line-highlight.line-highlight[data-end]:after {
background: unset;
color: unset;
padding: unset;
border-radius: unset;
box-shadow: unset;
}
/* Hovering over a linkable line number (in the gutter area) */
/* Requires Line Numbers plugin as well */
pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before {
background-color: unset;
}

View File

@ -1,152 +0,0 @@
/* https://prismjs.com/download.html#themes=prism&plugins=line-numbers+toolbar */
code[class*="language-"],
pre[class*="language-"] {
color: #000;
background: 0 0;
text-shadow: 0 1px #fff;
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
font-size: 1em;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
code[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
pre[class*="language-"]::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
code[class*="language-"] ::selection,
code[class*="language-"]::selection,
pre[class*="language-"] ::selection,
pre[class*="language-"]::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
pre[class*="language-"] {
padding: 1em;
margin: 0.5em 0;
overflow: auto;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
:not(pre) > code[class*="language-"] {
padding: 0.1em;
border-radius: 0.3em;
white-space: normal;
}
.token.cdata,
.token.comment,
.token.doctype,
.token.prolog {
color: #708090;
}
.token.punctuation {
color: #999;
}
.token.namespace {
opacity: 0.7;
}
.token.boolean,
.token.constant,
.token.deleted,
.token.number,
.token.property,
.token.symbol,
.token.tag {
color: #905;
}
.token.attr-name,
.token.builtin,
.token.char,
.token.inserted,
.token.selector,
.token.string {
color: #690;
}
.language-css .token.string,
.style .token.string,
.token.entity,
.token.operator,
.token.url {
color: #9a6e3a;
background: hsla(0, 0%, 100%, 0.5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.class-name,
.token.function {
color: #dd4a68;
}
.token.important,
.token.regex,
.token.variable {
color: #e90;
}
.token.bold,
.token.important {
font-weight: 700;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
pre[class*="language-"].line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}
pre[class*="language-"].line-numbers > code {
position: relative;
white-space: inherit;
}
.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: -3.8em;
width: 3em;
letter-spacing: -1px;
border-right: 1px solid #999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.line-numbers-rows > span {
display: block;
counter-increment: linenumber;
}
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: block;
padding-right: 0.8em;
text-align: right;
}

View File

@ -1,40 +0,0 @@
/**
* Match Braces plugin overrides
* https://prismjs.com/plugins/match-braces
*/
/* Style of braces on hover */
.token.token.punctuation.brace-hover,
.token.token.punctuation.brace-selected {
outline-color: unset; /* default: not set; inherits from .token.punctuation */
}
/* Braces when rainbow braces is enabled */
/* Feel free to re-organise the levels */
.rainbow-braces .token.token.punctuation.brace-level-1,
.rainbow-braces .token.token.punctuation.brace-level-5,
.rainbow-braces .token.token.punctuation.brace-level-9 {
color: unset;
outline-color: unset;
}
.rainbow-braces .token.token.punctuation.brace-level-2,
.rainbow-braces .token.token.punctuation.brace-level-6,
.rainbow-braces .token.token.punctuation.brace-level-10 {
color: unset;
outline-color: unset;
}
.rainbow-braces .token.token.punctuation.brace-level-3,
.rainbow-braces .token.token.punctuation.brace-level-7,
.rainbow-braces .token.token.punctuation.brace-level-11 {
color: unset;
outline-color: unset;
}
.rainbow-braces .token.token.punctuation.brace-level-4,
.rainbow-braces .token.token.punctuation.brace-level-8,
.rainbow-braces .token.token.punctuation.brace-level-12 {
color: unset;
outline-color: unset;
}

View File

@ -1,56 +0,0 @@
/**
* Previewers plugin overrides
* https://prismjs.com/plugins/previewers
*/
/* The main bulk of the popup */
.prism-previewer.prism-previewer:before,
.prism-previewer-gradient.prism-previewer-gradient div {
border-color: unset;
}
/* Specifically for border radius of the popup if you want to modify it */
/* Angle and time should remain as circles and are hence not included */
.prism-previewer-color.prism-previewer-color:before,
.prism-previewer-gradient.prism-previewer-gradient div,
.prism-previewer-easing.prism-previewer-easing:before {
border-radius: unset;
}
/* Triangle part of the popup pointing to the code */
.prism-previewer.prism-previewer:after {
border-top-color: unset;
}
.prism-previewer-flipped.prism-previewer-flipped.after {
border-bottom-color: unset;
}
/* Background colour within the popup */
.prism-previewer-angle.prism-previewer-angle:before,
.prism-previewer-time.prism-previewer-time:before,
.prism-previewer-easing.prism-previewer-easing {
background: unset;
}
/* For angle, this is the positive area (eg. 90deg will display one quadrant in this colour) */
/* For time, this is the alternate colour */
.prism-previewer-angle.prism-previewer-angle circle,
.prism-previewer-time.prism-previewer-time circle {
stroke: unset;
stroke-opacity: unset; /* default: 0.9 */
}
/* Stroke colours of the handle (circle), direction point (line), and vector itself (path) */
/* If you need help with the terminology: https://shapeshed.com/illustrator-101-the-pen-tool/ */
/* Feel free to style these separately */
.prism-previewer-easing.prism-previewer-easing circle,
.prism-previewer-easing.prism-previewer-easing line,
.prism-previewer-easing.prism-previewer-easing path {
stroke: unset;
}
/* Fill colour of the handle */
.prism-previewer-easing.prism-previewer-easing circle {
fill: unset;
}

View File

@ -1,12 +0,0 @@
/**
* Show Invisibles plugin overrides
* https://prismjs.com/plugins/show-invisibles
*/
/* Styling the look of the tokens */
.token.token.tab:not(:empty):before,
.token.token.cr:before,
.token.token.lf:before,
.token.token.space:before {
color: unset;
}

View File

@ -1,87 +0,0 @@
/**
* Toolbar plugin overrides
* https://prismjs.com/plugins/toolbar
* This is the third-most popular plugin
* Used in conjunction with Show Language, Copy to Clipboard Button, and/or Download Button
*/
/* The 'containers' holding the buttons (or pills) themselves */
div.code-toolbar > .toolbar.toolbar > .toolbar-item {
margin-right: unset; /* default: not set; there is no spacing */
}
/* Styling the buttons (or pills) */
/* Feel free to style them separately if that's what you prefer */
div.code-toolbar > .toolbar.toolbar > .toolbar-item > button,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > a,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > span {
background: unset;
color: unset;
padding: unset;
border-radius: unset;
}
div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover,
div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus {
background: unset;
color: unset;
}
div.code-toolbar {
position: relative;
}
div.code-toolbar > .toolbar {
position: absolute;
z-index: 10;
top: 0.3em;
right: 0.2em;
transition: opacity 0.3s ease-in-out;
opacity: 0;
}
div.code-toolbar:hover > .toolbar {
opacity: 1;
}
div.code-toolbar:focus-within > .toolbar {
opacity: 1;
}
div.code-toolbar > .toolbar > .toolbar-item {
display: inline-block;
}
div.code-toolbar > .toolbar > .toolbar-item > a {
cursor: pointer;
}
div.code-toolbar > .toolbar > .toolbar-item > button {
background: 0 0;
border: 0;
color: inherit;
font: inherit;
line-height: normal;
overflow: visible;
padding: 0;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
div.code-toolbar > .toolbar > .toolbar-item > a,
div.code-toolbar > .toolbar > .toolbar-item > button,
div.code-toolbar > .toolbar > .toolbar-item > span {
color: #bbb;
font-size: 0.8em;
padding: 0 0.5em;
background: #f5f2f0;
background: rgba(224, 224, 224, 0.2);
box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.2);
border-radius: 0.5em;
}
div.code-toolbar > .toolbar > .toolbar-item > a:focus,
div.code-toolbar > .toolbar > .toolbar-item > a:hover,
div.code-toolbar > .toolbar > .toolbar-item > button:focus,
div.code-toolbar > .toolbar > .toolbar-item > button:hover,
div.code-toolbar > .toolbar > .toolbar-item > span:focus,
div.code-toolbar > .toolbar > .toolbar-item > span:hover {
color: inherit;
text-decoration: none;
}

View File

@ -1,25 +0,0 @@
/**
* Treeview plugin overrides
* https://prismjs.com/plugins/treeview
*/
/* The lines */
/* Default for all: #ccc */
.token.token.treeview-part .line-h:before,
.token.token.treeview-part .line-v:before {
border-left-color: unset;
}
.token.token.treeview-part .line-v-last:before {
border-left-color: unset;
border-bottom-color: unset;
}
.token.token.treeview-part .line-h:after {
border-bottom-color: unset;
}
/* dotfile filenames such as '.gitignore' */
.token.token.treeview-part .entry-name-dotfile {
opacity: unset; /* default: 0.5 */
}

View File

@ -1,226 +0,0 @@
/**
* Your theme's name
* If this is an adaptation of an existing theme, credit the creator and/or leave a link to it!
* Optional: Your name and/or username
*/
/**
* Prism supports IE11, which does not support CSS variables
* However, you are encouraged to leave a list of colours you use here
* so that when we transition to Prism V2 (and drop support for IE11),
* the transition will be a little easier!
*/
/**
* How to use this template:
*
* This file contains all the boilerplate necessary for a Prism theme along with template rules for you to fill in.
*
* All properties with the value `unset` are for you to change.
* You should fill in all `color` and `background` properties.
* If you don't need an `unset` property (e.g. `border-radius`), then feel free to remove it.
* You are also free to add more properties that aren't stated, such as `text-shadow`.
* If you wish to style the plugins, you may grab their selectors from their respective .css files in the template folder.
*
* Your finished theme should have all `unset` properties either filled in or removed.
*/
/* Set the main properties of the code, code blocks, and inline code */
code[class*="language-"],
pre[class*="language-"] {
background: unset;
color: unset;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; /* this is the default */
/* The following properties are standard, please leave them as they are */
font-size: 1em;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
line-height: 1.5;
/* The default is 4, but you could change it if you really, really want to */
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
/* The following properties are also standard */
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* Optional: What the code looks like when highlighted */
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection,
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection {
background: unset;
color: unset;
}
code[class*="language-"]::selection,
code[class*="language-"] ::selection,
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection {
background: unset;
color: unset;
}
/* Properties specific to code blocks */
pre[class*="language-"] {
padding: 1em; /* this is standard */
margin: 0.5em 0; /* this is the default */
overflow: auto; /* this is standard */
border-radius: unset;
}
/* Properties specific to inline code */
:not(pre) > code[class*="language-"] {
padding: 0.1em; /* this is the default */
border-radius: unset;
white-space: normal; /* this is standard */
}
/**
* These are the minimum tokens you must style, you can rearrange them and/or style more tokens as you want
* The concepts behind these standard tokens, as well as some examples, can be found here: https://prismjs.com/tokens.html
*/
.token.comment {
color: unset;
}
.token.prolog {
color: unset;
}
.token.cdata {
color: unset;
}
.token.doctype {
color: unset;
}
.token.punctuation {
color: unset;
}
.token.entity {
color: unset;
}
.token.attr-name {
color: unset;
}
.token.class-name {
color: unset;
}
.token.boolean {
color: unset;
}
.token.constant {
color: unset;
}
.token.number {
color: unset;
}
.token.atrule {
color: unset;
}
.token.keyword {
color: unset;
}
.token.property {
color: unset;
}
.token.tag {
color: unset;
}
.token.symbol {
color: unset;
}
.token.deleted {
color: unset;
}
.token.important {
color: unset;
}
.token.selector {
color: unset;
}
.token.string {
color: unset;
}
.token.char {
color: unset;
}
.token.builtin {
color: unset;
}
.token.inserted {
color: unset;
}
.token.regex {
color: unset;
}
.token.attr-value {
color: unset;
}
.token.variable {
color: unset;
}
.token.operator {
color: unset;
}
.token.function {
color: unset;
}
.token.url {
color: unset;
}
/* The following rules are pretty similar across themes, but feel free to adjust them */
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
.token.namespace {
opacity: 0.7;
}
/* LANGUAGE-SPECIFIC OVERRIDES */
/* If you'd like your theme to have overrides for specific languages, here's an example, you can remove it and/or add more overrides */
.language-css .token.important {
color: unset;
}

View File

@ -12,6 +12,7 @@
<!-- prism -->
<th:block th:if="${theme.config.content.switch_highlight == 'prism'}">
<th:block th:include="modules/libs/prism :: import"></th:block>
<th:block th:include="modules/libs/prism :: script"></th:block>
</th:block>
</th:block>
</html>

View File

@ -3,13 +3,8 @@
<!-- head 中自定义的 -->
<head th:replace="modules/head :: head(metas = null,links = null, scripts = null)"></head>
<th:block th:if="${theme.config.content.enable_code_lineNumber}">
<link rel="stylesheet" th:href="@{/assets/libs/prism/template/plugin-line-numbers.css}"/>
</th:block>
<link rel="stylesheet" th:href="@{/assets/libs/prism/template/plugin-toolbar.css}"/>
<script th:src="@{/assets/libs/prism.js}"></script>
<body class="line-numbers">
<body>
<!-- loading 页面 -->
<div th:replace="modules/loading-box :: loading-box"></div>

View File

@ -6,17 +6,40 @@
<link rel="stylesheet" th:href="@{/assets/libs/prism/themes/{theme}(theme=${theme.config.content.prism_css})}"/>
</th:block>
<!-- 行号控制 css -->
<th:block th:if="${theme.config.content.enable_code_lineNumber}">
<link rel="stylesheet" th:href="@{/assets/libs/prism/plugins/line-numbers/prism-line-numbers.min.css}"/>
</th:block>
<!-- 工具栏 css -->
<link rel="stylesheet" th:href="@{/assets/libs/prism/plugins/toolbar/prism-toolbar.min.css}"/>
<!-- 自定义 css -->
<th:block th:if="${not #strings.isEmpty(theme.config.content.custom_prism_css)}">
<link rel="stylesheet" th:href="@{${theme.config.content.custom_prism_css}}"/>
</th:block>
<script th:src="@{/assets/libs/prism/prism.js}"></script>
</th:block>
<th:block th:fragment="script">
<script>
</script>
<script th:src="@{/assets/libs/prism/prism.js}"></script>
<!-- 行号控制 js -->
<th:block th:if="${theme.config.content.enable_code_lineNumber}">
<script th:src="@{/assets/libs/prism/plugins/line-numbers/prism-line-numbers.min.js}"></script>
</th:block>
<!-- 控制 toolbar -->
<script th:src="@{/assets/libs/prism/plugins/toolbar/prism-toolbar.min.js}"></script>
<!-- 显示语言 -->
<script th:src="@{/assets/libs/prism/plugins/show-language/prism-show-language.min.js}"></script>
<!-- 复制到剪贴板 -->
<script th:src="@{/assets/libs/prism/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js}"></script>
</th:block>

View File

@ -11,7 +11,7 @@
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">
<div id="article-container" th:utext="${singlePage.content.content}"></div>
<div id="article-container line-numbers" th:utext="${singlePage.content.content}"></div>
</div>
</main>
<!-- 底部 -->

View File

@ -76,7 +76,8 @@
<main class="layout" id="content-inner">
<div id="post">
<!-- 文章内容 -->
<article class="post-content" id="article-container" th:utext="${post.content.content}"></article>
<article class="post-content line-numbers" id="article-container"
th:utext="${post.content.content}"></article>
<div class="post-tools" id="post-tools">