Crates.io | k-lighter |
lib.rs | k-lighter |
version | 1.0.4 |
source | src |
created_at | 2023-08-20 12:14:49.712836 |
updated_at | 2023-09-04 13:42:24.324065 |
description | K-lighter is a syntax highlighter for K language. |
homepage | |
repository | |
max_upload_size | |
id | 949341 |
size | 33,457 |
K-lighter is a syntax highlighter for K language.
Use cargo to install this package:
cargo install k-lighter
You can also build this package from source. Clone this repo using the following command:
git clone https://github.com/ondrachwiedziuk/k-lighter.git
Then enter main directory and run:
cargo install --path .
To have better performance, you can write alias in your .bashrc file:
alias k-lighter="$HOME/.cargo/bin/k-lighter"
To use k-lighter, write:
k-lighter [OPTIONS] <INPUT> <OUTPUT>
Name | Description |
---|---|
INPUT |
Path to your K script. |
OUTPUT |
Path to HTML file where highlighted code will be located. |
Short | Long | Description |
---|---|---|
-s |
--style |
Style which is used [default: basic] |
-h |
--help |
Print help |
-V |
--version |
Print version |
To highlight file foo.k
, write:
k-lighter foo.k foo.html
You can also customize styles. Just append your pattern to the end of $HOME/.cargo/k-lighter.ini
file.
Patterns have the following structure:
[NAME]
numbers = HEX_COLOR
vars = HEX_COLOR
verbs = HEX_COLOR
adverbs = HEX_COLOR
reserved = HEX_COLOR
pars_0 = HEX_COLOR
pars_1 = HEX_COLOR
pars_2 = HEX_COLOR
pars_3 = HEX_COLOR
comments = HEX_COLOR
string = HEX_COLOR
background = HEX_COLOR
Default style is basic
:
[basic]
numbers = ffffff
vars = ffff00
verbs = 00ffff
adverbs = ff00ff
reserved = ff0000
pars_0 = 006600
pars_1 = 009900
pars_2 = 00cc00
pars_3 = 00ff00
comments = 0000ff
string = 508050
background = 000000
This project is supposed to be used inside text editors. However, this project is written in Rust, so it requires some JavaScript to wrap this core and make it work with text editors like VS Code.
Another direction of this project can be some smarter features like recognizing unused variables, formatting a code by some template and checking correct syntax of K.