Skip to content

Editor.addHighlights method

Editor › addHighlights

Unofficial

Make ranges of text highlighted within the editor given specified class (style).

Signature:

addHighlights(ranges: EditorRange[], style: "is-flashing" | "obsidian-search-match-highlight", removePrevious: boolean, range?: EditorSelection | undefined): void

Parameters:

ParameterTypeDescription
rangesEditorRange[]The ranges to highlight.
style"is-flashing" | "obsidian-search-match-highlight"The highlight style class.
removePreviousbooleanWhether to remove previous highlights.
range?EditorSelection | undefinedThe editor selection range.

Returns: void