highlight_manager.ts view source
Manages CSS Custom Highlight API ranges for a single element. Tracks ranges per element and only removes its own ranges when clearing.
Experimental — limited browser support. Use Code.svelte for production.
examples
const manager = new HighlightManager();
manager.highlight_from_syntax_tokens(element, tokens);element_ranges
type Map<string, Array<Range>>
constructor
type new (): HighlightManager
highlight_from_syntax_tokens
Highlights from a SyntaxTokenStream produced by tokenize_syntax.
type (element: Element, tokens: SyntaxTokenStream): void
element
type
Elementtokens
type SyntaxTokenStream
returns
voidclear_element_ranges
Clears only this element's ranges from highlights.
type (): void
returns
voiddestroy
type (): void
returns
void