UNPKG

@nova-ui/bits

Version:

SolarWinds Nova Framework

38 lines (37 loc) 1.46 kB
import { PipeTransform } from "@angular/core"; import { SafeHtml } from "@angular/platform-browser"; import * as i0 from "@angular/core"; /** * <example-url>./../examples/index.html#/pipes/highlight</example-url> * * The nuiHighlight pipe is used to mark a portion of text. It will search the provided text for the specified string and highlight it. Returns HTML. * Can only be used with `innerHTML` directive. Escapes all the characters by default and highlights every match in the string. * * __Parameters :__ * * text - The source text. * * search - The search term to be highlighted. * * __Usage :__ * "text" | nuiHighlight : "search" * * __Examples :__ * * <code>{{ "hello world" | nuiHighlight:"world" }}</code> * * formats to: <code>hello &lt;span class="nui-highlighted"&gt;world&lt;/span&gt;</code> * * * <code>{{ "hello &lt;span class="x"&gt;FOO&lt;/span&gt; bar" | nuiHighlight:"bar" }}</code> * * formats to: <code>hello &lt;span class=&quot;x&quot;&gt;FOO&lt;/span&gt;&lt;span class="nui-highlighted"&gt;bar&lt;/span&gt;;</code> */ export declare class HighlightPipe implements PipeTransform { private readonly deduplicateStarsRegex; transform(text: string, search: string): SafeHtml; escapeItem(item: string): string; private getHighlightRegex; static ɵfac: i0.ɵɵFactoryDeclaration<HighlightPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<HighlightPipe, "nuiHighlight", false>; }