diff options
Diffstat (limited to 'editors/html_syntax_highlighting')
| -rwxr-xr-x | editors/html_syntax_highlighting/html_syntax_highlighting.sh | 15 | ||||
| -rw-r--r-- | editors/html_syntax_highlighting/prism.css | 150 | ||||
| -rw-r--r-- | editors/html_syntax_highlighting/prism_sail.js | 33 |
3 files changed, 198 insertions, 0 deletions
diff --git a/editors/html_syntax_highlighting/html_syntax_highlighting.sh b/editors/html_syntax_highlighting/html_syntax_highlighting.sh new file mode 100755 index 00000000..953aa00d --- /dev/null +++ b/editors/html_syntax_highlighting/html_syntax_highlighting.sh @@ -0,0 +1,15 @@ +#!/bin/sh +cat << END_HEADER +<!DOCTYPE html> +<title>TODO: CHANGE TITLE</title> +<link rel="stylesheet" href="prism.css"> +<script src="prism.js"></script> +<script src="prism_sail.js"></script> +<p>TODO: include <a href="https://prismjs.com/download.html#themes=prism">prism.js</a></p> +<pre class=""><code class="language-sail line-numbers"> +END_HEADER +cat +cat << END_FOOTER +</code> +</pre> +END_FOOTER diff --git a/editors/html_syntax_highlighting/prism.css b/editors/html_syntax_highlighting/prism.css new file mode 100644 index 00000000..0dd55d34 --- /dev/null +++ b/editors/html_syntax_highlighting/prism.css @@ -0,0 +1,150 @@ +/* PrismJS 1.17.1 +https://prismjs.com/download.html#themes=prism */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*="language-"], +pre[class*="language-"] { + color: black; + background: none; + text-shadow: 0 1px white; + 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; +} + +pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*="language-"]::selection, pre[class*="language-"] ::selection, +code[class*="language-"]::selection, code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment { + color: #690; + background-color: #e5f5e0; +} +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.string { + color: darkred; +} + +.token.selector, +.token.attr-name, +.token.char, +.token.builtin, +.token.inserted { + color: darkblue; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + /*color: #07a;*/ + color: #e90; +} + +.token.function, +.token.class-name { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #07a; + /* color: #e90; *. +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + diff --git a/editors/html_syntax_highlighting/prism_sail.js b/editors/html_syntax_highlighting/prism_sail.js new file mode 100644 index 00000000..b27404f1 --- /dev/null +++ b/editors/html_syntax_highlighting/prism_sail.js @@ -0,0 +1,33 @@ +Prism.languages.sail = { + 'comment': [ + { + pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, + lookbehind: true + }, + { + pattern: /(^|[^\\:])\/\/.*/, + lookbehind: true, + greedy: true + } + ], + // Depending on the implementation, strings may allow escaped newlines and quote-escape + 'string': { + pattern: /(["])(?:\1\1|\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, + greedy: true + }, + 'operator': /:|->|==|!=|{\||\|}|=>|=|\+|-|@|\(\)|\(|\)|_|;|&|~|\.\.|,|\^|\*/, + 'keyword': [ + { + pattern: /(^|[^.])\b(type|union|register|function|clause|scattered|val|effect|end|true|false|let|if|then)\b/, + lookbehind: true + } + ], + //'builtin': /\b(?:fx|fy|xf[xy]?|yfx?)\b/, + 'builtin': /\b[A-Z][A-Za-z_\-\/0-9']*/, + 'variable': /\b'?[a-z_][A-Za-z_\-\/0-9']*/, + //'function': /\b[a-z_]\w*(?:(?=\()|\/\d+)/, + 'number': /\b0b\d+|\b\d+\.?\d*/, + // Custom operators are allowed + 'punctuation': /[(){}\[\],:]/ +}; + |
