PHPackages                             bogdancondorachi/kirby-code-highlighter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bogdancondorachi/kirby-code-highlighter

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

bogdancondorachi/kirby-code-highlighter
=======================================

Server-side syntax highlighter for Kirby CMS.

1.1.1(1y ago)18622↓33.3%2[1 issues](https://github.com/bogdancondorachi/kirby-code-highlighter/issues)[1 PRs](https://github.com/bogdancondorachi/kirby-code-highlighter/pulls)MITVuePHP &gt;=8.2CI passing

Since Nov 28Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/bogdancondorachi/kirby-code-highlighter)[ Packagist](https://packagist.org/packages/bogdancondorachi/kirby-code-highlighter)[ Docs](https://github.com/bogdancondorachi/kirby-code-highlighter)[ GitHub Sponsors](https://github.com/bogdancondorachi)[ RSS](/packages/bogdancondorachi-kirby-code-highlighter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

[![Kirby Code Highlighter](.github/preview-v2.png)](.github/preview-v2.png)

[![Version](https://camo.githubusercontent.com/92de59fe7550a46e275dc8f2ef672e830d3bc4918dea47b65c27d360f482a86a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626f6764616e636f6e646f72616368692f6b697262792d636f64652d686967686c6967687465723f7374796c653d666f722d7468652d6261646765266c6162656c3d56657273696f6e266c6162656c436f6c6f723d33643434346426636f6c6f723d303936424445)](https://camo.githubusercontent.com/92de59fe7550a46e275dc8f2ef672e830d3bc4918dea47b65c27d360f482a86a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626f6764616e636f6e646f72616368692f6b697262792d636f64652d686967686c6967687465723f7374796c653d666f722d7468652d6261646765266c6162656c3d56657273696f6e266c6162656c436f6c6f723d33643434346426636f6c6f723d303936424445)[![Dependency](https://camo.githubusercontent.com/9598a8d2f7b79e9bee141c9c2a58853e0bb216f7cf8d8112980ec0abffc560b2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6b697262792d253545342e302d4634453136323f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d336434343464)](https://camo.githubusercontent.com/9598a8d2f7b79e9bee141c9c2a58853e0bb216f7cf8d8112980ec0abffc560b2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6b697262792d253545342e302d4634453136323f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d336434343464)[![Dependency](https://camo.githubusercontent.com/2855d69e524f115a17d7fd1c28dce4331c5fe3a87356050355e7703a35a2582b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f626f6764616e636f6e646f72616368692f6b697262792d636f64652d686967686c6967687465722f7068703f7374796c653d666f722d7468652d6261646765266c6162656c3d504850266c6162656c436f6c6f723d33643434346426636f6c6f723d374337324646)](https://camo.githubusercontent.com/2855d69e524f115a17d7fd1c28dce4331c5fe3a87356050355e7703a35a2582b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f626f6764616e636f6e646f72616368692f6b697262792d636f64652d686967686c6967687465722f7068703f7374796c653d666f722d7468652d6261646765266c6162656c3d504850266c6162656c436f6c6f723d33643434346426636f6c6f723d374337324646)

Note

A server-side syntax highlighter plugin for Kirby CMS, powered by [Phiki](https://github.com/phikiphp/phiki), that uses TextMate grammars and VS Code themes to generate syntax-highlighted code within Kirby's code block and KirbyText. Also with [Shiki](https://shiki.style) implementation for live code block preview inside the Kirby Panel!

✨ Key Features
--------------

[](#-key-features)

- ⚡ **Performance:** Fast and powerful syntax highlighting.
- 🚀 **Integration:** Works with Kirby's code block and KirbyText.
- 👁️ **Panel Preview:** Live code preview in the Kirby Panel.
- 🌍 **Languages:** Over 200+ supported languages.
- 🎨 **Themes:** Choose from 50+ VS Code themes.
- 🔐 **Base64 Support:** Handles base64-encoded content.

📦 Installation
--------------

[](#-installation)

### Composer

[](#composer)

```
composer require bogdancondorachi/kirby-code-highlighter
```

### Git Submodule

[](#git-submodule)

```
git submodule add https://github.com/bogdancondorachi/kirby-code-highlighter.git site/plugins/code-highlighter
```

### Manual

[](#manual)

[Download the plugin](https://api.github.com/repos/bogdancondorachi/kirby-code-highlighter/zipball) and extract it to: `/site/plugins/code-highlighter`

⚙️ Usage
--------

[](#️-usage)

### Kirby Blocks Field

[](#kirby-blocks-field)

This plugin overwrites the Kirby's native [code block](https://getkirby.com/docs/reference/panel/blocks/code), the output will be highlighted automatically.

```
blocks:
  type: blocks
  fieldsets:
    - code
```

*By default, the code block uses the [default theme](#default-theme). A theme selector is provided for applying different themes to individual blocks. You can also [customize](#customize-languages-and-themes-selection) the available languages and themes.*

### KirbyText

[](#kirbytext)

Embed syntax-highlighted code directly in KirbyText fields:

```
```php
echo "Hello, world!";
```

```

Or use the plugin's custom KirbyTag with support for base64-encoded content:

```
(code: ZWNobyAiSGVsbG8sIHdvcmxkISI7 lang: php theme: github-light)

```

*By default, the code tag applies the [default theme](#default-theme). However, you can use the theme attribute to specify a different theme for individual code blocks.*

🔧 Configuration
---------------

[](#-configuration)

All options goes into your `config.php` file:

### Default Theme

[](#default-theme)

Set the default theme:

```
'bogdancondorachi.code-highlighter' => [
  'theme' => 'github-dark-default',
],
```

*Check out the [supported](#explore-supported-languages-and-themes) themes*

### Default Language

[](#default-language)

Set the default language:

```
'bogdancondorachi.code-highlighter' => [
  'language' => 'text',
],
```

*Check out the [supported](#explore-supported-languages-and-themes) languages*

### Light/Dark Dual Themes

[](#lightdark-dual-themes)

If you use light/dark mode on your website, you can set a default theme for each individual mode:

```
'bogdancondorachi.code-highlighter' => [
  'themes' => [
    'light' => 'github-light',
    'dark' => 'github-dark'
  ]
],
```

In this case, you'll need to add one of the CSS snippet's to make it reactive to your site's theme:

#### Query-based Dark Mode

[](#query-based-dark-mode)

```
@media (prefers-color-scheme: light) {
  .phiki,
  .phiki span {
    color: var(--phiki-light);
    background-color: var(--phiki-light-bg);
  }
}

@media (prefers-color-scheme: dark) {
  .phiki,
  .phiki span {
    color: var(--phiki-dark);
    background-color: var(--phiki-dark-bg);
  }
}
```

#### Class-based Dark Mode

[](#class-based-dark-mode)

```
html.light .phiki,
html.light .phiki span {
  color: var(--phiki-light);
  background-color: var(--phiki-light-bg);
}

html.dark .phiki,
html.dark .phiki span {
  color: var(--phiki-dark);
  background-color: var(--phiki-dark-bg);
}
```

### Line Numbering

[](#line-numbering)

Enable line numbers in your rendered code blocks:

```
'bogdancondorachi.code-highlighter' => [
  'gutter' => true,
],
```

### Customize Languages and Themes Selection

[](#customize-languages-and-themes-selection)

Customize the languages and themes options available in Kirby’s code block:

```
'bogdancondorachi.code-highlighter' => [
  'block.languages' => [
    'css' => 'CSS',
    'php' => 'PHP',
    'yml' => 'Yaml',
  ],
  'block.themes' => [
    'github-dark' => 'GitHub Dark',
    'github-light' => 'GitHub Light',
    'vitesse-dark' => 'Vitesse Dark',
  ],
],
```

#### Explore Supported Languages and Themes

[](#explore-supported-languages-and-themes)

- [Supported Languages](https://shiki.matsu.io/languages)
- [Supported Themes](https://shiki.matsu.io/themes)

### Front-end Block Styling

[](#front-end-block-styling)

Further customize the block style to match your site's design. Here's an example:

```
.phiki {
  margin: 2rem 0;
  padding: 1rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  overflow: auto;
  border-radius: 0.25rem;
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.phiki .line-number {
  margin-right: 1rem;
  text-align: right;
}
```

🙏 Credits
---------

[](#-credits)

- [Ryan Chandler](https://github.com/ryangjchandler) for porting Shiki to PHP via [Phiki](https://github.com/phikiphp/phiki), which powers this plugin.
- [Johann Schopplich](https://github.com/johannschopplich) for his [Kirby Highlighter](https://github.com/johannschopplich/kirby-highlighter), which served as base for this project.

📜 License
---------

[](#-license)

[MIT License](./LICENSE) Copyright © 2024 [Bogdan Condorachi](https://github.com/bogdancondorachi)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance71

Regular maintenance activity

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~33 days

Total

5

Last Release

397d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9eaf70d8b4bb15f56f486bc83603613139479b751806cda601a7187ebd07bccf?d=identicon)[bogdancondorachi](/maintainers/bogdancondorachi)

---

Top Contributors

[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (52 commits)")[![bogdancondorachi](https://avatars.githubusercontent.com/u/39380741?v=4)](https://github.com/bogdancondorachi "bogdancondorachi (37 commits)")

---

Tags

kirbykirby-cmskirby-pluginkirby4kirby4-pluginkirby5kirby5-plugin

### Embed Badge

![Health badge](/badges/bogdancondorachi-kirby-code-highlighter/health.svg)

```
[![Health](https://phpackages.com/badges/bogdancondorachi-kirby-code-highlighter/health.svg)](https://phpackages.com/packages/bogdancondorachi-kirby-code-highlighter)
```

###  Alternatives

[distantnative/retour-for-kirby

Manage redirects and track 404s right from the Kirby CMS Panel

14689.4k1](/packages/distantnative-retour-for-kirby)[mzur/kirby-uniform

A versatile Kirby plugin to handle web form actions.

26068.3k13](/packages/mzur-kirby-uniform)[arnoson/kirby-vite

Vite helper for Kirby CMS

9759.2k3](/packages/arnoson-kirby-vite)[thathoff/kirby-git-content

Plugin to track changes to content in a git repository.

15343.7k](/packages/thathoff-kirby-git-content)[sylvainjule/locator

A map &amp; geolocation field, built on top of open-source services / Mapbox

11237.3k1](/packages/sylvainjule-locator)[tobimori/kirby-seo

The default choice for SEO on Kirby: Implement technical SEO &amp; Meta best practices with ease and provide an easy-to-use editor experience

10039.7k1](/packages/tobimori-kirby-seo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
