Skip to content
Themeable server-side syntax highlighting for Kirby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets/css
vendor
.editorconfig
.gitattributes
.gitignore
.php_cs.dist
LICENSE
README.md
composer.json
composer.lock
index.php
screenshot.gif

README.md

Kirby3 Highlight

Release License Issues

This plugin highlights your code snippets server-side - without external dependencies.

screenshot of the kirby3-highlight plugin

Table of contents

Getting started

Use one of the following methods to install & use kirby3-highlight:

Git submodule

If you know your way around Git, you can download this plugin as a submodule:

git submodule add https://github.com/S1SYPHOS/kirby3-highlight.git site/plugins/kirby-highlight

Composer

composer require s1syphos/kirby3-highlight

Clone or download

  1. Clone or download this repository.
  2. Unzip / Move the folder to site/plugins.

Now proper classes are added to your code snippets, making them 'themeable'. In order to do so, head over to the styling section.

Configuration

Change kirby-highlight options to suit your needs:

Option Type Default Description
s1syphos.highlight.class String 'hljs' Adds one or more classes to the preceding pre element.
s1syphos.highlight.languages Array ['html', 'php'] Defines languages to be auto-detected (currently 176 languages are supported).
s1syphos.highlight.escaping Boolean false Enables character escaping (converting < to &lt;, > to &gt;, ..), see htmlspecialchars() docs.

Styling

All highlight.js styles are fully compatible with kirby3-highlight. Just include it using the css() helper:

<?= css('/media/plugins/s1syphos/highlight/css/zenburn.css') ?>

Troubleshooting

If in doubt, check the correct spelling of the language in question - doing otherwise might break kirbytext().

Credits / License

kirby3-highlight is based on Geert Bergman's highlight.php library (a PHP port of highlight.js). It is licensed under the MIT License, but using Kirby in production requires you to buy a license.

Special Thanks

I'd like to thank everybody that's making great software - you people are awesome. Also I'm always thankful for feedback and bug reports :)

You can’t perform that action at this time.