stripHtmlTags function is a utility for removing HTML tags from a string. This function uses regular expressions to strip out HTML markup while preserving the text content, making it useful for sanitizing user input, extracting plain text from HTML, or preparing content for text-only displays.ts
import { stripHtmlTags } from "@arkyn/shared";
rawHtml (required)stringstringtypescript
import { stripHtmlTags } from "@arkyn/shared";const result = stripHtmlTags("<p>Hello <strong>World</strong></p>");console.log(result);// Output: "Hello World"
<script> tags, then <style> tags, then HTML comments, and finally all other HTML tags.<script>) and their entire content are completely removed to prevent any JavaScript code from remaining in the output, enhancing security.<style>) and their entire content are also removed to eliminate any CSS styling information.<!-- ... -->) are stripped from the string, removing any developer notes or hidden content.<DIV>, <div>, <Div> are all removed). , <, >) - these will remain in the output string.