next generation of the syntaxhighlighter, with prism.js
Go to file
DeltaLima 13ab2b4580 line-numbers config now done and working :) 2023-06-22 16:04:50 +02:00
res line-numbers config now done and working :) 2023-06-22 16:04:50 +02:00
.gitignore added missing plugin css files, added more languages to prism.small.js, added some more plugins 2023-06-22 14:54:33 +02:00
LICENSE add MIT license 2023-06-21 21:58:43 +02:00
README.md added missing plugin css files, added more languages to prism.small.js, added some more plugins 2023-06-22 14:54:33 +02:00
config.php line-numbers config now done and working :) 2023-06-22 16:04:50 +02:00
plugin.syntaxhighlighter.php keep it simple, implementing to configure plugins would be too much for now, line-numbers boolean is enough atm 2023-06-22 15:52:58 +02:00

README.md

syntaxhighlighter-ng

Origin: https://git.la10cy.net/DeltaLima/flatpress-plugin-syntaxhighlighter-ng

Demo: https://deltalima.org/blog/index.php/syntaxhighlighter-ng-testpage/

based on the original FlatPress plugin syntaxhighlighter from 2005, updated in 2023 to prism.js

installation

Download the latest release and extract syntaxhighlighter-ng_v1.x.x.zip to your fp-plugins/ folder.

If you want to use git, use

$ git clone https://git.la10cy.net/DeltaLima/flatpress-plugin-syntaxhighlighter-ng.git /pathto/flatpress/fp-plugins/syntaxhighlighter/

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:

[code=bash]
if [ "$1" == "bash" ] 
then
  echo "Yeah :)"
else 
  echo "something else"
fi
[/code]

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
/*
 * size: tiny, small, full
 *
 * 	  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)
 *
 *	  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'],
]
?>