• C 97%
  • V 1.6%
  • Lua 1%
  • Makefile 0.4%
Find a file
2026-04-26 16:18:33 +03:00
cmd Release v2.2.1 2026-04-26 16:18:33 +03:00
lang_data Release v2.2.0 2026-04-26 12:08:39 +03:00
.editorconfig almost there 2026-04-13 11:42:09 +03:00
.gitattributes almost there 2026-04-13 11:42:09 +03:00
.gitignore working looking for bugs 2026-04-13 12:40:09 +03:00
convert.lua updated readme 2026-04-13 17:44:51 +03:00
highlight_standalone.c commit.sh vmod test 2026-04-13 15:46:22 +03:00
highlighter.v Release v2.2.1 2026-04-26 16:18:33 +03:00
LICENSE Release v2.2.0 2026-04-26 12:08:39 +03:00
Makefile commit.sh vmod test 2026-04-13 15:46:22 +03:00
README.md Release v2.2.1 2026-04-26 16:18:33 +03:00
v.mod Release v2.2.0 2026-04-26 12:08:39 +03:00

V Highlighter

Sorry, this version is broken. Try an older version or come back later.

A lightweight, native V module to inject (Prism-compatible css) syntax highlighting into static HTML files at build time. No client-side JavaScript required.

Features

  • Native V: No external regex engine dependencies.
  • Fast: High-speed scanner (FSM)
  • Prism Compatible: Outputs standard token classes.
  • Auto-detection: Automatically highlights blocks with class="language-xxx" or defaults to Bash.

Documentation

Installation

For V Users

v install https://codeberg.org/tamer/highlighter.git

For C Users

make compile_c_linux   - Build using GCC from the C file
make compile_c_windows - Build for Win using MinGW from the C file

Usage

As a CLI tool

highlight --verbose --force /var/www

As a Module

import highlighter

mut hl := highlighter.new_manager()
html_output := hl.highlight_html(markdown_generated_html)

Using make

$ make help
make build             - Local optimized V build
make c_source          - Update standalone highlight_standalone.c
make compile_c_linux   - Build using GCC from the C file
make compile_c_windows - Build for Win using MinGW from the C file
make dist              - Create optimized Linux, Win, Mac binaries

Structure

.
├── highlighter.v           # Logic moved to root
├── v.mod                   # Module info
├── highlight_standalone.c  # Standalone C
├── Makefile
├── lang_data/              # JSON language files
├── cmd/
│   └── main.v              # CLI entry point
└── convert.lua             # Bootstrap script

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

  • Google Gemini: For collaborating on the native V scanner logic and the conversion pipeline.
  • Lite XL: For the comprehensive syntax definitions that power the language support.
  • Prism CSS: For the beautiful themes and standardized token naming conventions.