val_highlight 0.1.0
val_highlight: ^0.1.0 copied to clipboard
Syntax highlighting for 55 languages in pure Dart. Incremental updates, themes, VS Code theme import, and HTML output. Runs on every platform.
0.1.0 #
First release.
val_highlight is a syntax highlighter written in pure Dart. It runs
anywhere Dart runs — the VM, Flutter on every platform, and the web — and is
the shared core of val_highlight_flutter.
Added #
- 55 languages — Dart, Kotlin, Swift, Java, Objective-C, C, C++, C#, Go,
Rust, Zig, JavaScript, TypeScript, JSX, TSX, HTML (with embedded CSS and
JavaScript, including
.vueand.svelte), CSS, SCSS, Less, PHP, Python, Ruby, Lua, Perl, Bash, PowerShell, Batch, R, Julia, Elixir, Erlang, Haskell, OCaml, F#, Scala, Clojure, Groovy / Gradle, SQL, JSON, YAML, TOML, XML, INI / properties, Protobuf, GraphQL, HCL / Terraform, nginx, Dockerfile, Makefile, CMake, Markdown (fenced code in any language), LaTeX, NASM, Solidity and diff. genericLanguage— a fallback that highlights code in any language reasonably, andplainTextLanguage.- Incremental highlighting —
IncrementalHighlighterre-scans only what an edit can affect. - Flat token output — tokens as two integer lists with a shared scope table, plus a line API for renderers.
- 8 themes — light, dark, sepia, dim, midnight, forest, high-contrast light and dark. Every colour meets WCAG AA contrast.
- VS Code themes —
ValTheme.fromVsCodeandValTheme.fromVsCodeJson. - HTML output — CSS classes with
ValTheme.toCss, or inline styles. - Language detection —
LanguageDetector, by file name, shebang and content. - Grammar building blocks —
LineComment,BlockComment,QuotedString,Interpolation,Numbers,Operators,Annotation,PreprocessorandCommonRules, so most grammars need no regular expressions. ExtendBlockRulefor your own. - Customisation —
Grammar.extend,Grammar.withKeywords,ValTheme.extend, andLanguageRegistrywith fallbacks and file-name matching.