跳到主要内容

Code

Code block component with syntax highlighting support.

Properties

code

code: Signal<string, this>;

Code content.

language

language: Signal<string, this>;

Programming language.

highlighter

highlighter: CodeHighlighter;

Syntax highlighter.

selection

selection: Signal<CodeRange>;

Current selection.

Methods

findFirstRange

findFirstRange(search: string | RegExp): CodeRange | null

Finds the first matching code range.

findAllRanges

findAllRanges(search: string | RegExp): CodeRange[]

Finds all matching code ranges.

findLastRange

findLastRange(search: string | RegExp): CodeRange | null

Finds the last matching code range.

getPointBBox

getPointBBox(range: CodeRange): BBox

Gets the bounding box of a code range.

getSelectionBBox

getSelectionBBox(): BBox

Gets the bounding box of the current selection.

Static Methods

createSignal

Code.createSignal<T>(initial: T): Signal<T>

Creates a signal.