Expand description
Inkjet is a batteries-included syntax highlighting library for Rust, based on tree-sitter
.
§Getting Started
- To get started with highlighting, take a look at the
Highlighter
type. - See the
formatter
module for the output options bundled with Inkjet, and thetheme
module for the optional theming API. - If you’d like to write your own formatter, see the
Formatter
trait.
§Included Languages
Click to expand...
Name | Recognized Tokens |
---|---|
Ada | ada |
Assembly (generic) | asm |
Awk | awk |
Bash | bash , sh , shell |
BibTeX | bibtex , bib |
Bicep | bicep |
Blueprint | blueprint , blp |
C | c , h |
Cap’N Proto | capnp |
Clojure | clojure , clj , cljc |
C# | c_sharp , c# , csharp , cs |
C++ | c++ , cpp , hpp , h++ , cc , hh |
CSS | css |
Cue | cue |
D | d , dlang |
Dart | dart |
Diff | diff |
Dockerfile | dockerfile , docker |
EEx | eex |
Emacs Lisp | elisp , emacs-lisp , el |
Elixir | ex , exs , leex |
Elm | elm |
Erlang | erl , hrl , es , escript |
Forth | forth , fth |
Fortran | fortran , for |
Fish | fish |
GDScript | gdscript , gd |
Gleam | gleam |
GLSL | glsl |
Go | go , golang |
Haskell | haskell , hs |
HCL | hcl , terraform |
HEEx | heex |
HTML | html , htm |
INI | ini |
JavaScript | javascript , js |
JSON | json |
JSX | jsx |
Julia | julia , jl |
Kotlin | kotlin , kt , kts |
LaTeX | latex , tex |
LLVM | llvm |
Lua | lua |
GNU Make | make , makefile , mk |
MatLab | matlab , m |
Meson | meson |
Nix | nix |
Objective C | objective_c , objc |
OCaml | ocaml , ml |
OCaml Interface | ocaml_interface , mli |
OpenSCAD | openscad , scad |
Pascal | pascal |
PHP | php |
ProtoBuf | protobuf , proto |
Python | python , py |
R | r |
Racket | racket , rkt |
Regex | regex |
Ruby | ruby , rb |
Rust | rust , rs |
Scala | scala |
Scheme | scheme , scm , ss |
SCSS | scss |
SQL (Generic) | sql |
Swift | swift |
TOML | toml |
TypeScript | typescript , ts |
TSX | tsx |
Vimscript | vimscript , vim |
WAST (WebAssembly Script) | wast |
WAT (WebAssembly Text) | wat , wasm |
x86 Assembly | x86asm , x86 |
WGSL | wgsl |
YAML | yaml |
Zig | zig |
In addition to these languages, Inkjet also offers the Runtime
and Plaintext
languages.
Runtime
wraps afn() -> &'static HighlightConfiguration
pointer, which is used to resolve the language at (you guessed it) runtime.Plaintext
enables cheap no-op highlighting. It loads thediff
grammar under the hood, but provides no highlighting queries. It’s aliased tonone
andnolang
.
§Cargo Features
- (Default)
html
- enables the bundled HTML formatter, which depends onv_htmlescape
and thetheme
feature. - (Default)
theme
- enables the theme API, which depends onahash
,toml
andserde
. - (Default)
all-languages
- enables all languages. language-{name}
- enables the specified language.- If you want to only enable a subset of the included languages, you’ll have to set
default-features=false
and manually re-add each language you want to use.
- If you want to only enable a subset of the included languages, you’ll have to set
Re-exports§
pub use tree_sitter_highlight;
Modules§
- constants
- Common constants.
- formatter
- Traits and implementations for formatting the output of highlighters.
- theme
theme
- Types for highlighting themes.
Structs§
- Highlighter
- A type for highlighting code.
Enums§
- Inkjet
Error - Concrete error type for all possible Inkjet errors.
- Language
- The set of all languages supported by Inkjet.
- Theme
Error theme
- Concrete error type for
theme
-related errors.
Type Aliases§
- Result
- Shorthand for
Result<T, InkjetError>
.