flatpress-plugin-syntaxhigh.../README.md

72 lines
2.4 KiB
Markdown
Raw Normal View History

# syntaxhighlighter-ng
2023-06-21 01:54:02 +02:00
Origin: https://git.la10cy.net/DeltaLima/flatpress-plugin-syntaxhighlighter-ng
2023-06-21 02:10:21 +02:00
Demo: https://deltalima.org/blog/index.php/syntaxhighlighter-ng-testpage/
2023-06-21 21:09:30 +02:00
based on the original FlatPress plugin [syntaxhighlighter from 2005](https://forum.flatpress.org/viewtopic.php?p=1130&hilit=syntax+highlight#p1135), updated in 2023 to prism.js
2023-06-21 01:42:23 +02:00
## installation
2023-06-21 21:09:30 +02:00
Download the [latest release](https://git.la10cy.net/DeltaLima/flatpress-plugin-syntaxhighlighter-ng/releases) and extract `syntaxhighlighter-ng_v1.x.x.zip` to your `fp-plugins/` folder.
2023-06-21 01:42:23 +02:00
2023-06-21 21:09:30 +02:00
If you want to use git, use
2023-06-21 01:43:51 +02:00
```shell
2023-06-21 21:09:30 +02:00
$ git clone https://git.la10cy.net/DeltaLima/flatpress-plugin-syntaxhighlighter-ng.git /pathto/flatpress/fp-plugins/syntaxhighlighter/
2023-06-21 01:42:23 +02:00
```
## 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:
```
2023-06-21 01:17:12 +02:00
[code=bash]
if [ "$1" == "bash" ]
then
echo "Yeah :)"
else
echo "something else"
fi
[/code]
```
2023-06-22 00:27:23 +02:00
For all language tags see https://prismjs.com/#supported-languages
Not all listed languages are available by default, please see the configuration below!
# configuration
You can configure the used size of prismjs and it's theme. For that just edit `config.php` and set your favorite.
The default values are `small` for size (see available languages below) and `okaidia` for the theme.
```php
<?php
/*
* size: tiny, small, full
*
2023-06-22 16:06:42 +02:00
* tiny: 21KB (Markup, HTML, XML, SVG, MathML, SSML, Atom, RSS, CSS, C-like, JavaScript)
2023-06-22 00:27:23 +02:00
*
2023-06-22 16:06:42 +02:00
* 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)
2023-06-22 00:27:23 +02:00
*
2023-06-22 16:06:42 +02:00
* full: 567KB (see https://prismjs.com/index.html#supported-languages for list of supported languages)
2023-06-22 00:27:23 +02:00
*
* theme: coy, dark, default, funky, okaidia, solarizedlight, tomorrow, twilight
*
2023-06-22 16:06:42 +02:00
* line-numbers: 'true' or 'false' (Do show line numbers or not)
*
2023-06-22 00:27:23 +02:00
*/
return [
2023-06-22 16:06:42 +02:00
// change here
'size' => 'small',
'theme' => 'okaidia',
'line-numbers' => 'true',
2023-06-22 00:27:23 +02:00
]
?>
```