mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
9 lines
286 B
JavaScript
9 lines
286 B
JavaScript
import {helper} from 'ember-helper';
|
|
import {htmlSafe} from 'ember-string';
|
|
|
|
export function highlightedText([text, termToHighlight]) {
|
|
return htmlSafe(text.replace(new RegExp(termToHighlight, 'ig'), '<span class="highlight">$&</span>'));
|
|
}
|
|
|
|
export default helper(highlightedText);
|