s1syphos/kirby-highlight

This package is abandoned and no longer maintained. No replacement package was suggested.

Themeable server-side syntax highlighting for Kirby

Installs: 14

Dependents: 0

Suggesters: 0

Security: 0

Stars: 14

Watchers: 2

Forks: 0

Open Issues: 1

Language:CSS

Type:kirby-plugin

0.6.1 2019-03-25 10:46 UTC

This package is auto-updated.

Last update: 2021-12-25 19:10:37 UTC


README

Release License Issues

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

  • Code highlighting for everyone - no javascript needed
  • Comprehensive: supports 176 languages
  • Customisable: 79 different styles included

screenshot of the kirby-highlight plugin

Table of contents

Getting started

Use one of the following methods to install & use kirby-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/kirby-highlight.git site/plugins/kirby-highlight

Composer

composer require S1SYPHOS/kirby-highlight:dev-composer

Clone or download

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

Activate the plugin

Activate the plugin with the following line in your config.php:

c::set('plugin.kirby-highlight', true);

Now proper classes are added to your code snippets, making them 'themeable'. In order to do so, head over to the styling section. If you want to activate kirby-highlight only on specific domains, read about multi-environment setups.

Configuration

Change kirby-highlight options to suit your needs:

Option Type Default Description
plugin.kirby-highlight.class String 'hljs' Sets class of surrounding pre container.
plugin.kirby-highlight.languages Array ['html', 'php'] Defines languages to be auto-detected (currently 176 languages are supported).
plugin.kirby-highlight.escaping Boolean false Enables character escaping (converting < to &lt;, > to &gt;, ..), see htmlspecialchars() docs.

Styling

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

<?php echo css('assets/plugins/kirby-highlight/css/zenburn.css') ?>

Troubleshooting

If in doubt, check the correct spelling of the language in question - doing otherwise breaks kirbytext() (see #2).

Credits / License

kirby-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. Are you ready for the next step?

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 :)