isHtml function is a utility for detecting whether a string contains HTML markup. This function uses regular expressions to identify HTML tags in a string, making it useful for validating user input, sanitizing content, or determining whether a string needs HTML parsing.ts
import { isHtml } from "@arkyn/shared";
rawString (required)stringtrue if the string contains HTML markup (opening or closing tags), and false if it contains only plain text or is empty.booleantypescript
import { isHtml } from "@arkyn/shared";const result = isHtml("<p>Hello world</p>");console.log(result);// Output: true
<div>, <p>) and closing tags (e.g., </div>, </p>).false./<?[a-z][\s\S]*>/i matches any tag that starts with a letter (a-z), allowing for flexibility in detecting various HTML elements.