From 3d92690d424acf91620f148771e50327e2ad5fb5 Mon Sep 17 00:00:00 2001 From: Skyebee Date: Thu, 27 Aug 2026 00:48:16 -0400 Subject: [PATCH] Add prism for syntax highlighting --- LICENSE | 26 + theme/css/prism.css | 1 + theme/index.php | 6 +- theme/js/prism.js | 1 + theme/libs/prism.css | 140 +++ theme/libs/prism.js | 2395 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 2567 insertions(+), 2 deletions(-) create mode 120000 theme/css/prism.css create mode 120000 theme/js/prism.js create mode 100644 theme/libs/prism.css create mode 100644 theme/libs/prism.js diff --git a/LICENSE b/LICENSE index 77c2bac..f8a6264 100644 --- a/LICENSE +++ b/LICENSE @@ -50,3 +50,29 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +PrismJS license + +MIT LICENSE + +Copyright (c) 2012 Lea Verou + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/theme/css/prism.css b/theme/css/prism.css new file mode 120000 index 0000000..7a09052 --- /dev/null +++ b/theme/css/prism.css @@ -0,0 +1 @@ +../libs/prism.css \ No newline at end of file diff --git a/theme/index.php b/theme/index.php index ff09bb5..b8ddf33 100644 --- a/theme/index.php +++ b/theme/index.php @@ -20,10 +20,11 @@ +
-
+
@@ -32,7 +33,8 @@
+
- \ No newline at end of file + diff --git a/theme/js/prism.js b/theme/js/prism.js new file mode 120000 index 0000000..4fcfb7a --- /dev/null +++ b/theme/js/prism.js @@ -0,0 +1 @@ +../libs/prism.js \ No newline at end of file diff --git a/theme/libs/prism.css b/theme/libs/prism.css new file mode 100644 index 0000000..caf33f0 --- /dev/null +++ b/theme/libs/prism.css @@ -0,0 +1,140 @@ +/* PrismJS 1.30.0 +https://prismjs.com/download#themes=prism-okaidia&languages=markup+css+clike+javascript+diff+gdscript+python&plugins=diff-highlight */ +/** + * okaidia theme for JavaScript, CSS and HTML + * Loosely based on Monokai textmate theme by http://www.monokai.nl/ + * @author ocodia + */ + +code[class*="language-"], +pre[class*="language-"] { + color: #f8f8f2; + background: none; + text-shadow: 0 1px rgba(0, 0, 0, 0.3); + 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 blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + border-radius: 0.3em; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background:#0c0534; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: #8292a2; +} + +.token.punctuation { + color: #f8f8f2; +} + +.token.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.constant, +.token.symbol, +.token.deleted { + color: #f92672; +} + +.token.boolean, +.token.number { + color: #ae81ff; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #a6e22e; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string, +.token.variable { + color: #f8f8f2; +} + +.token.atrule, +.token.attr-value, +.token.function, +.token.class-name { + color: #e6db74; +} + +.token.keyword { + color: #66d9ef; +} + +.token.regex, +.token.important { + color: #fd971f; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +pre.diff-highlight > code .token.deleted:not(.prefix), +pre > code.diff-highlight .token.deleted:not(.prefix) { + background-color: rgba(255, 0, 0, .1); + color: inherit; + display: block; +} + +pre.diff-highlight > code .token.inserted:not(.prefix), +pre > code.diff-highlight .token.inserted:not(.prefix) { + background-color: rgba(0, 255, 128, .1); + color: inherit; + display: block; +} + diff --git a/theme/libs/prism.js b/theme/libs/prism.js new file mode 100644 index 0000000..57fb799 --- /dev/null +++ b/theme/libs/prism.js @@ -0,0 +1,2395 @@ +/* PrismJS 1.30.0 +https://prismjs.com/download#themes=prism-okaidia&languages=markup+css+clike+javascript+awk+bash+diff+gdscript+java+json+python&plugins=diff-highlight */ +/// + +var _self = (typeof window !== 'undefined') + ? window // if in browser + : ( + (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) + ? self // if in worker + : {} // if in node js + ); + +/** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT + * @author Lea Verou + * @namespace + * @public + */ +var Prism = (function (_self) { + + // Private helper vars + var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i; + var uniqueId = 0; + + // The grammar object for plaintext + var plainTextGrammar = {}; + + + var _ = { + /** + * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the + * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load + * additional languages or plugins yourself. + * + * By setting this value to `true`, Prism will not automatically highlight all code elements on the page. + * + * You obviously have to change this value before the automatic highlighting started. To do this, you can add an + * empty Prism object into the global scope before loading the Prism script like this: + * + * ```js + * window.Prism = window.Prism || {}; + * Prism.manual = true; + * // add a new