keep it simple, implementing to configure plugins would be too much for now, line-numbers boolean is enough atm

This commit is contained in:
Marcus 2023-06-22 15:52:58 +02:00
parent 45ae9c42dc
commit 9f78840174
6 changed files with 12 additions and 21 deletions

View file

@ -4,17 +4,17 @@
*
* tiny: 21KB (Markup, HTML, XML, SVG, MathML, SSML, Atom, RSS, CSS, C-like, JavaScript)
*
* small: 95KB (Markup, HTML, XML,SVG, MathML, SSML, Atom, RSS, CSS, C-Linke, JavaScript
* Apache, Arduino, Bash Shell, Batch, BBCode, C, C#, C++, CMake, CSV, Diff,
* Docker, Git, Go, HTTP, ini, Java, JSON, Log file, Makefile, Markdown,nginx,
* Pascal, Perl, PHP, PowerShell, Python, Ruby, Shell session, SQL, Typescript,
* VB.Net, Visual Basic, Wiki markup, YML)
* small: 95KB (markup, css, clike, javascript, apacheconf, arduino, bash, basic, batch,
* bbcode, c, cpp, cmake, csv, diff, docker, git, go, http, ini, java, json,
* log, makefile, markdown, markup-templating, nginx, pascal, perl, php,
* powershell, python, ruby, shell-session, sql, typescript, vbnet,
* visual-basic, wiki, yaml)
*
* full: 567KB (see https://prismjs.com/index.html#supported-languages for list of supported languages)
*
* theme: coy, dark, default, funky, okaidia, solarizedlight, tomorrow, twilight
*
* plugins: line-numbers, unescaped-markup, diff-highlight, toolbar, copy-to-clipboard (depends on toolbar)
* line-numbers: 'true' or 'false' (Do show line numbers or not)
*
*/
@ -22,6 +22,6 @@ return [
// change here
'size' => 'small',
'theme' => 'okaidia',
'plugins' => ['unescaped-markup', 'line-numbers', 'diff-highlight'],
'line-numbers' => true,
]
?>

View file

@ -67,8 +67,6 @@ function plugin_syntaxhighlighter_foot() {
// convert the returned array into a json one, to have an easier time
// giving it to the javascript below
$used_languages = json_encode(plugin_syntaxhighlighter_add());
// put configured plugins into an json array
$used_plugins = json_encode($config['plugins']);
$pdir=plugin_geturl('syntaxhighlighter');
// javascript part
@ -84,8 +82,8 @@ echo <<<PRISMBOX
<!-- call wrap_pre_tags() from syntaxhighlighter-ng.js -->
<script type="text/javascript">
var used_languages = {$used_languages};
var used_plugins = {$used_plugins};
wrap_pre_tags(used_languages, used_plugins);
var enable_line_numbers = {$config['line-numbers']};
wrap_pre_tags(used_languages, enable_line_numbers);
</script>
<!-- end of prism.js footer -->

View file

@ -2,7 +2,3 @@
[class*=lang-] script[type='text/plain'],[class*=language-] script[type='text/plain'],script[type='text/plain'][class*=lang-],script[type='text/plain'][class*=language-]{display:block;font:100% Consolas,Monaco,monospace;white-space:pre;overflow:auto}
/* line-numbers */
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}
/* diff-highlight */
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}
/* toolbar */
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}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -24,7 +24,7 @@
function wrap_pre_tags(used_languages, used_plugins) {
function wrap_pre_tags(used_languages, enable_line_numbers) {
// convert used_plugins array to a space seperated string
var used_plugins = used_plugins.join(' ');