You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Components/Highlighter/Highlighter.razor

22 lines
535 B

@namespace Connected.Components
@inherits UIComponent
@using System.Text.RegularExpressions
@using static Connected.Components.Splitter
@foreach (var fragment in _fragments.Span)
{
if (!string.IsNullOrWhiteSpace(_regex)
&& Regex.IsMatch(fragment,
_regex,
CaseSensitive
? RegexOptions.None
: RegexOptions.IgnoreCase))
{
<mark class="@Class" style="@Style" @attributes="@UserAttributes"> @fragment </mark>
}
else
{
@fragment
}
}