Expand description
Process-wide registry of HighlightConfigurations, keyed by language
name. Owned via Arc so every Syntax instance holds a cheap clone
and the injection callback in Highlighter::highlight can look up
sibling configs (markdown block → markdown_inline; markdown’s fenced
code blocks → rust / python / javascript / etc.) without each
Syntax carrying its own copy.
§Why an Arc registry instead of per-document configs
HighlightConfiguration::new does the expensive setup (compiling
the highlights and injections queries against the language). Per-
document copies would multiply that cost and inflate memory. The
registry constructs each config once at startup; Syntax instances
borrow refs through the shared Arc<LangRegistry>.
The injection callback that Highlighter::highlight takes returns
Option<&'a HighlightConfiguration> where 'a is the highlighter’s
borrow lifetime. Closing the callback over &self.registry lets the
callback return refs that live for the highlight call.
Structs§
- Grammar
Spec - Everything a runtime-registered language supplies beyond its identity.
- Lang
Registry - Catalog of every supported language’s parser + highlight + injection
configuration. Construct once via
Self::standardand share byArcclone.
Functions§
- live
- Snapshot the live registry.