Skip to content

renderMatches

Official

Render the matches of a search.

Import:

import { renderMatches } from 'obsidian';

Signature:

function renderMatches(el: DocumentFragment | HTMLElement, text: string, matches: SearchMatches | null, offset?: number): void

Parameters:

Parameter Type Description
el DocumentFragment | HTMLElement The element to render the matches to.
text string The text to render the matches to.
matches SearchMatches | null The matches to render.
offset? number The offset to render the matches to.

Returns: void

Example:

renderMatches(document.body, 'foo', [[0, 3]]);