This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Highlights occurrences of keywords within content. | |
* @param {string} content - The content in which to highlight keywords. | |
* @param {string} query - The keyword or keywords to highlight (comma-separated). | |
* @param {boolean} removeSpans - Whether to remove existing <span> tags before highlighting. Default is true. | |
* @returns {string} The content with highlighted keywords. | |
*/ | |
export function highlightKeyword(content: string, query: string, removeSpans = true): string { | |
if (!query) return content; |