Code highlighter for html files
https://tamer.pw/en/code/v/highlighter.html
c
cli
code
highlighter
markdown
markdown-to-html
module
static-site-generator
static-website
syntax-highlighting
v
vlang
- C 97%
- V 1.6%
- Lua 1%
- Makefile 0.4%
| cmd | ||
| lang_data | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| convert.lua | ||
| highlight_standalone.c | ||
| highlighter.v | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| v.mod | ||
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
tokenclasses. - 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.