Skip to content

Commit 839a79b

Browse files
chore: initial commit
0 parents  commit 839a79b

File tree

635 files changed

+360925
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

635 files changed

+360925
-0
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[*]
2+
charset = utf-8
3+
indent_style = space
4+
indent_size = 2
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*.php]
10+
indent_size = 2
11+
12+
[*.md,*.txt]
13+
trim_trailing_whitespace = false
14+
insert_final_newline = false
15+
16+
[composer.json]
17+
indent_size = 2

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Git
2+
.github/ export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
6+
# Development files
7+
.editorconfig export-ignore

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: bogdancondorachi

.github/ISSUE_TEMPLATE/bug.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: 🐛 Bug Report
3+
about: Report if something isn't working as expected
4+
title: 'Bug: '
5+
labels: 'type: bug 🐛'
6+
assignees: 'bogdancondorachi'
7+
---
8+
9+
## Description
10+
11+
12+
## Steps to Reproduce
13+
1. Go to '...'
14+
2. Click on '...'
15+
3. See error
16+
17+
18+
## Screenshots
19+
20+
21+
## Environment:
22+
- **Browser:** [e.g. Chrome, Firefox, Safari]
23+
- **Plugin Version:** [e.g. 2.4.0]
24+
- **Kirby Version:** [e.g. 4.4.1, 4.3.8]
25+
26+
27+
## Additional Context
28+
- **Field Blueprint:**
29+
- **Field Content:**

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: 🎉 Feature Request
3+
about: Suggest an idea for a new feature
4+
title: 'Feature Request: '
5+
labels: 'type: feature 🎉'
6+
assignees: 'bogdancondorachi'
7+
---
8+
9+
## Summary
10+
11+
12+
## Why is this feature needed?

.github/preview.png

562 KB
Loading

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# OS files
2+
.DS_Store
3+
4+
# Development and Temporary files
5+
/tests
6+
composer.lock

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Bogdan Condorachi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
![Kirby Code Highlighter](.github/preview.png)
2+
3+
# Kirby Code Highlighter
4+
5+
> [!NOTE]
6+
> 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 code blocks and KirbyText.
7+
8+
## ✨ Key Features
9+
-**Performance:** Fast and powerful syntax highlighting.
10+
- 🚀 **Integration:** Works with Kirby code blocks and KirbyText.
11+
- 🌍 **Languages:** Over 200+ programming languages.
12+
- 🎨 **Themes:** Choose from 50+ stunning themes.
13+
- 🔐 **Base64 Support:** Handles base64-encoded content.
14+
15+
## 📦 Installation
16+
17+
### Composer
18+
19+
```bash
20+
composer require bogdancondorachi/kirby-code-highlighter
21+
```
22+
23+
### Git Submodule
24+
```bash
25+
git submodule add https://github.com/bogdancondorachi/kirby-code-highlighter.git site/plugins/code-highlighter
26+
```
27+
28+
### Manual
29+
30+
[Download](https://api.github.com/repos/bogdancondorachi/kirby-code-highlighter/zipball) and extract to:<br />`/site/plugins/code-highlighter`
31+
32+
## ⚙️ Usage
33+
34+
### Kirby Blocks Field
35+
36+
This plugin seamlessly integrates with Kirby's native [`code` block](https://getkirby.com/docs/reference/panel/blocks/code) replacing its default behavior:
37+
38+
```yaml
39+
blocks:
40+
type: blocks
41+
fieldsets:
42+
- code
43+
```
44+
45+
### KirbyText
46+
Embed syntax-highlighted code directly in KirbyText fields:
47+
48+
<pre lang="no-highlight"><code>```php
49+
echo "Hello, world!";
50+
```
51+
</code></pre>
52+
53+
Or use the plugin's custom KirbyTag with support for base64-encoded content:
54+
55+
```
56+
(code: ZWNobyAiSGVsbG8sIHdvcmxkISI7 lang: php theme: github-light)
57+
```
58+
59+
## 🔧 Configuration
60+
These options allow you to customize themes, language support, line numbering, and block behavior. All options are defined in your `config.php` file.
61+
62+
### Default Theme
63+
Set the default theme for syntax highlighting:
64+
65+
```php
66+
'bogdancondorachi.code-highlighter' => [
67+
'theme' => 'github-dark-dimmed',
68+
],
69+
```
70+
71+
### Line Numbering
72+
Enable line numbers in your highlighted code blocks:
73+
74+
```php
75+
'bogdancondorachi.code-highlighter' => [
76+
'gutter' => true,
77+
],
78+
```
79+
80+
### Custom Languages and Themes for Code Blocks
81+
Customize the languages and themes available in Kirby’s code blocks:
82+
83+
```php
84+
'bogdancondorachi.code-highlighter' => [
85+
'block.languages' => [
86+
'css' => 'CSS',
87+
'php' => 'PHP',
88+
'js' => 'JavaScript',
89+
],
90+
'block.themes' => [
91+
'github-dark' => 'GitHub Dark',
92+
'github-light' => 'GitHub Light',
93+
'plastic' => 'Plastic',
94+
],
95+
],
96+
```
97+
98+
### Explore Supported Options
99+
- [Supported Languages](https://shiki.matsu.io/languages)
100+
- [Supported Themes](https://shiki.matsu.io/themes)
101+
102+
## 🙏 Credits
103+
- [Ryan Chandler](https://github.com/ryangjchandler) for his excellent work on porting Shiki to PHP via [Phiki](https://github.com/phikiphp/phiki).
104+
- [Johann Schopplich](https://github.com/johannschopplich) for his [Kirby Highlighter](https://github.com/johannschopplich/kirby-highlighter), which served as base for this project.
105+
106+
## 📜 License
107+
[MIT License](./LICENSE) Copyright © 2024 [Bogdan Condorachi](https://github.com/bogdancondorachi)

composer.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "bogdancondorachi/kirby-code-highlighter",
3+
"description": "Server-side syntax highlighter for Kirby CMS.",
4+
"type": "kirby-plugin",
5+
"license": "MIT",
6+
"version": "1.0.0-beta.1",
7+
"homepage": "https://github.com/bogdancondorachi/kirby-code-highlighter",
8+
"authors": [
9+
{
10+
"name": "Bogdan Condorachi",
11+
"email": "[email protected]",
12+
"homepage": "https://plugins.getkirby.com/bogdancondorachi"
13+
}
14+
],
15+
"require": {
16+
"php": ">=8.2",
17+
"phiki/phiki": "^0.3.2",
18+
"getkirby/composer-installer": "^1.2"
19+
},
20+
"replace": {
21+
"league/commonmark": "*"
22+
},
23+
"config": {
24+
"allow-plugins": {
25+
"getkirby/composer-installer": true
26+
}
27+
},
28+
"extra": {
29+
"installer-name": "code-highlighter"
30+
}
31+
}

0 commit comments

Comments
 (0)