added missing plugin css files, added more languages to prism.small.js, added some more plugins
This commit is contained in:
parent
4d23ed4753
commit
0a3f88ada4
5 changed files with 54 additions and 29 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
makerelease.sh
|
||||
mirror.sh
|
||||
syntaxhighlighter/
|
||||
syntaxhighlighter-*.zip
|
16
README.md
16
README.md
|
@ -45,23 +45,27 @@ The default values are `small` for size (see available languages below) and `oka
|
|||
/*
|
||||
* size: tiny, small, full
|
||||
*
|
||||
* tiny: 21KB (Markup, HTML, XML, SVG, MathML, SSML, Atom, RSS, CSS, C-like, JavaScript)
|
||||
* 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, Bash, Batch, BBCode, C, C#, C++, CSV, Diff, Go, HTTP, ini, Java
|
||||
* JSON, Makefile, Markdown, nginx, Perl, PHP, PowerShell, Python, Ruby
|
||||
* Shell session, SQL, VB.Net, Wiki markup, YML)
|
||||
* 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)
|
||||
*
|
||||
* full: 567KB (see https://prismjs.com/index.html#supported-languages for list of supported languages)
|
||||
* 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)
|
||||
*
|
||||
*/
|
||||
|
||||
return [
|
||||
// change here
|
||||
'size' => 'small',
|
||||
'theme' => 'okaidia',
|
||||
'plugins' => ['unescaped-markup', 'line-numbers', 'diff-highlight'],
|
||||
]
|
||||
?>
|
||||
```
|
||||
|
|
|
@ -51,7 +51,8 @@ function plugin_syntaxhighlighter_head() {
|
|||
echo <<<PRISMJS
|
||||
<!-- start of prism.js header -->
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{$pdir}res/prism-{$config['theme']}.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{$pdir}res/prism.plugins.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{$pdir}res/prism-{$config['theme']}.css" />
|
||||
|
||||
<!-- end of prism.js header -->
|
||||
PRISMJS;
|
||||
|
@ -63,26 +64,26 @@ add_action('wp_head', 'plugin_syntaxhighlighter_head');
|
|||
|
||||
function plugin_syntaxhighlighter_foot() {
|
||||
|
||||
$config = include('config.php');
|
||||
// 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());
|
||||
$config = include('config.php');
|
||||
// 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());
|
||||
|
||||
$pdir=plugin_geturl('syntaxhighlighter');
|
||||
// javascript part
|
||||
echo <<<PRISMBOX
|
||||
<!-- start of prism.js footer -->
|
||||
$pdir=plugin_geturl('syntaxhighlighter');
|
||||
// javascript part
|
||||
echo <<<PRISMBOX
|
||||
<!-- start of prism.js footer -->
|
||||
|
||||
<script type="text/javascript" src="{$pdir}res/prism.{$config['size']}.js"></script>
|
||||
<script type="text/javascript" src="{$pdir}res/prism.{$config['size']}.js"></script>
|
||||
|
||||
<!-- include wrapping-function to wrap content of pre html-tags into code-tags, as said in https://prismjs.com/index.html#basic-usage -->
|
||||
<script type="text/javascript" src="{$pdir}res/syntaxhighlighter-ng.js"></script>
|
||||
<!-- include wrapping-function to wrap content of pre html-tags into code-tags, as said in https://prismjs.com/index.html#basic-usage -->
|
||||
<script type="text/javascript" src="{$pdir}res/syntaxhighlighter-ng.js"></script>
|
||||
|
||||
<!-- call wrap_pre_tags() from syntaxhighlighter-ng.js -->
|
||||
<script type="text/javascript">
|
||||
var used_languages = {$used_languages};
|
||||
wrap_pre_tags(used_languages);
|
||||
</script>
|
||||
<!-- call wrap_pre_tags() from syntaxhighlighter-ng.js -->
|
||||
<script type="text/javascript">
|
||||
var used_languages = {$used_languages};
|
||||
wrap_pre_tags(used_languages);
|
||||
</script>
|
||||
|
||||
<!-- end of prism.js footer -->
|
||||
PRISMBOX;
|
||||
|
|
8
res/prism.plugins.css
Normal file
8
res/prism.plugins.css
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* unescaped-markup */
|
||||
[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
Loading…
Reference in a new issue