recreated prism.small.js and documented chosen languages in README

This commit is contained in:
DeltaLima 2023-06-21 01:11:10 +02:00
parent f8c4e07a4b
commit 7c8674e976
3 changed files with 65 additions and 7 deletions

View File

@ -1 +1,33 @@
syntaxhighlighter-ng based on the original fp-plugin from 2005, updated to 2023 with prism.js
# syntaxhighlighter-ng
based on the original FlatPress plugin [from 2005](https://forum.flatpress.org/viewtopic.php?p=1130&hilit=syntax+highlight#p1135), updated in 2023 to prism.js
## codeblock with language syntax highlightning
When you just create an `[code][/code]` block, then there will be no syntax highlightning.
To enable it, you have to specify the language you want to get highlighted, for example:
```
```
See the https://prismjs.com/#supported-languages for all supported languages by the contained `prism.full.js`
The included `prism.small.js` just has the most popular I know:
```
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
```
To change the theme, your favorite from https://prismjs.com and place it into `fp-plugins/syntaxhighlighter/res/`.
Then look after the block `<!-- start of prism.js header -->` in `fp-plugins/syntaxhighlighter/plugin.syntaxhighlighter.php` and change the following line:
```
<link rel="stylesheet" type="text/css" href="{$pdir}res/prism.okaidia.css" />
```
to
```
<link rel="stylesheet" type="text/css" href="{$pdir}res/prism.YOURTHEMENAME.css" />
```

View File

@ -27,11 +27,11 @@ function plugin_syntaxhighlighter_add($lang=null) {
function plugin_syntaxhighlighter_head() {
$pdir=plugin_geturl('syntaxhighlighter');
echo <<<PRISMJS
<!-- start of prism.js -->
<!-- start of prism.js header -->
<link rel="stylesheet" type="text/css" href="{$pdir}res/prism.okaidia.css" />
<!-- end of prism.js -->
<!-- end of prism.js header -->
PRISMJS;
}
@ -47,7 +47,7 @@ function plugin_syntaxhighlighter_foot() {
$pdir=plugin_geturl('syntaxhighlighter');
// javascript part
echo <<<PRISMBOX
<!-- start of prism.js -->
<!-- start of prism.js footer -->
<script type="text/javascript" src="{$pdir}res/prism.full.js"></script>
@ -90,7 +90,7 @@ function plugin_syntaxhighlighter_foot() {
}
</script>
<!-- end of prism.js -->
<!-- end of prism.js footer -->
PRISMBOX;
}
add_action('wp_footer', 'plugin_syntaxhighlighter_foot');

File diff suppressed because one or more lines are too long