k-lighter

Crates.iok-lighter
lib.rsk-lighter
version1.0.4
sourcesrc
created_at2023-08-20 12:14:49.712836
updated_at2023-09-04 13:42:24.324065
descriptionK-lighter is a syntax highlighter for K language.
homepage
repository
max_upload_size
id949341
size33,457
Ondřej Chwiedziuk (ondrachwiedziuk)

documentation

README

K-lighter

K-lighter is a syntax highlighter for K language.

Installation

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"

Usage

To use k-lighter, write:

k-lighter [OPTIONS] <INPUT> <OUTPUT>

Arguments

Name Description
INPUT Path to your K script.
OUTPUT Path to HTML file where highlighted code will be located.

Options

Short Long Description
-s --style Style which is used [default: basic]
-h --help Print help
-V --version Print version

Example

To highlight file foo.k, write:

k-lighter foo.k foo.html

Custom styles

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

Conclusion

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.

Commit count: 0

cargo fmt