engine library
Flutter-free entrypoint: the TextMate tokenizer and the pluggable regex
engine seam, with no dart:ui/widget dependencies.
Import this (instead of shiki_flutter.dart) from non-Flutter contexts:
a native engine bridge, a CLI, or a dart test that must avoid dart:ui.
Flutter apps keep using shiki_flutter.dart, which exposes the same
tokenizer plus the rendering widgets.
Classes
- CodeLanguage
- A bundled TextMate grammar and its metadata (id, aliases, display name, classification, and the embedded grammars it depends on).
- OnigCaptureIndex
-
A captured range within a match. Mirrors
IOnigCaptureIndex. - OnigMatch
-
The result of OnigScanner.findNextMatch. Mirrors
IOnigMatch. - OnigScanner
- Scans a line for the earliest match among a set of patterns.
- OnigString
-
Wraps a string being scanned. Mirrors
OnigString. - ShikiDualTheme
- A pair of themes that resolve switches between based on brightness, letting a highlighter track light/dark mode without being rebuilt.
- ShikiHighlighter
- A synchronous, TextMate-grammar based syntax highlighter.
- ShikiHighlighterConfig
- Global defaults for ShikiHighlighter, split by platform so IO and web can be configured independently.
- ShikiHighlighterEmbeddedEngine
-
The default engine: the pure-Dart
DartOnigScannerbacked byOnigRegex. - ShikiHighlighterEngine
-
Factory for scanners and strings: the pluggable engine seam. Mirrors
vscode-textmate'sIOnigLib. - ShikiTheme
- A single bundled theme description.
- ShikiThemeBase
- A theme, or a light/dark pair of themes, that a ShikiTheme highlighter can be configured with. Implemented by ShikiTheme (a single theme) and ShikiDualTheme (a light/dark pair resolved at highlight time).
- ThemedToken
- A single highlighted token: a run of characters sharing one style.
- TokenCache
-
A bounded least-recently-used cache from a tokenize key to its
List<List<ThemedToken>>result. - TokenizeOptions
- Options for ShikiHighlighter.codeToTokens.
Enums
- GrammarCategory
-
The classification tags a CodeLanguage can carry, mirroring the
GrammarCategoryunion fromtm-grammars.
Constants
- kUnmatchedOffset → const int
- Sentinel used for capture groups that did not participate in a match.
Exceptions / Errors
- ShikiError
- Thrown for highlighter usage errors (unknown language/theme, etc.).