{
  "name": "strip-html",
  "title": "stripHtmlToText",
  "description": "Projects HTML to a single-line plain-text preview for cards and meta descriptions. Not a security boundary — output is rendered as text only.",
  "type": "utility",
  "registryDependencies": [],
  "files": [
    {
      "path": "utils/strip-html.ts",
      "content": "/**\n * Project HTML to a single-line plain-text preview. NOT a security boundary —\n * output is only ever rendered as text (never as HTML). For card/meta previews\n * where tags must not appear.\n */\nexport function stripHtmlToText(html: string | null | undefined): string {\n  if (!html) return \"\";\n  return html\n    .replace(/<[^>]*>/g, \" \") // strip tags BEFORE decoding entities\n    .replace(/&nbsp;/gi, \" \")\n    .replace(/&amp;/gi, \"&\")\n    .replace(/&lt;/gi, \"<\")\n    .replace(/&gt;/gi, \">\")\n    .replace(/&quot;/gi, '\"')\n    .replace(/&#0*39;|&apos;/gi, \"'\")\n    .replace(/&#(\\d+);/g, (_, n) => String.fromCodePoint(Number(n)))\n    .replace(/&#x([0-9a-f]+);/gi, (_, n) => String.fromCodePoint(parseInt(n, 16)))\n    .replace(/\\s+/g, \" \")\n    .trim();\n}\n"
    }
  ]
}
