Skip to content

renderResults

Official

Render the results of a search.

Import:

import { renderResults } from 'obsidian';

Example:

renderResults(document.body, 'foo', {
score: 0.5,
matches: [[0, 3]],
});

Signature:

function renderResults(el: HTMLElement, text: string, result: SearchResult, offset: number | undefined): void

Parameters:

ParameterTypeDescription
elHTMLElementThe element to render the results to.
textstringThe text to render the results to.
resultSearchResultThe result to render.
offsetnumber | undefinedThe offset to render the results to.

Returns: void

Example:

renderResults(document.body, 'foo', {
score: 0.5,
matches: [[0, 3]],
});