Crate inkjet

source ·
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 the theme module for the optional theming API.
  • If you’d like to write your own formatter, see the Formatter trait.

§Included Languages

Click to expand...
NameRecognized Tokens
Adaada
Assembly (generic)asm
Awkawk
Bashbash, sh, shell
BibTeXbibtex, bib
Bicepbicep
Blueprintblueprint, blp
Cc, h
Cap’N Protocapnp
Clojureclojure, clj, cljc
C#c_sharp, c#, csharp, cs
C++c++, cpp, hpp, h++, cc, hh
CSScss
Cuecue
Dd, dlang
Dartdart
Diffdiff
Dockerfiledockerfile, docker
EExeex
Emacs Lispelisp, emacs-lisp, el
Elixirex, exs, leex
Elmelm
Erlangerl, hrl, es, escript
Forthforth, fth
Fortranfortran, for
Fishfish
GDScriptgdscript, gd
Gleamgleam
GLSLglsl
Gogo, golang
Haskellhaskell, hs
HCLhcl, terraform
HEExheex
HTMLhtml, htm
INIini
JavaScriptjavascript, js
JSONjson
JSXjsx
Juliajulia, jl
Kotlinkotlin, kt, kts
LaTeXlatex, tex
LLVMllvm
Lualua
GNU Makemake, makefile, mk
MatLabmatlab, m
Mesonmeson
Nixnix
Objective Cobjective_c, objc
OCamlocaml, ml
OCaml Interfaceocaml_interface, mli
OpenSCADopenscad, scad
Pascalpascal
PHPphp
ProtoBufprotobuf, proto
Pythonpython, py
Rr
Racketracket, rkt
Regexregex
Rubyruby, rb
Rustrust, rs
Scalascala
Schemescheme, scm, ss
SCSSscss
SQL (Generic)sql
Swiftswift
TOMLtoml
TypeScripttypescript, ts
TSXtsx
Vimscriptvimscript, vim
WAST (WebAssembly Script)wast
WAT (WebAssembly Text)wat, wasm
x86 Assemblyx86asm, x86
WGSLwgsl
YAMLyaml
Zigzig

In addition to these languages, Inkjet also offers the Runtime and Plaintext languages.

  • Runtime wraps a fn() -> &'static HighlightConfiguration pointer, which is used to resolve the language at (you guessed it) runtime.
  • Plaintext enables cheap no-op highlighting. It loads the diff grammar under the hood, but provides no highlighting queries. It’s aliased to none and nolang.

§Cargo Features

  • (Default) html - enables the bundled HTML formatter, which depends on v_htmlescape and the theme feature.
  • (Default) theme - enables the theme API, which depends on ahash, toml and serde.
  • (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.

Re-exports§

Modules§

  • Common constants.
  • Traits and implementations for formatting the output of highlighters.
  • themetheme
    Types for highlighting themes.

Structs§

Enums§

  • Concrete error type for all possible Inkjet errors.
  • The set of all languages supported by Inkjet.
  • Concrete error type for theme-related errors.

Type Aliases§