ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function stripHTML

    • Strips HTML tags from a string.

      Parameters

      • html: string

        The HTML string to strip

      Returns string

      The string with HTML tags removed

      stripHTML("<p>Hello <b>world</b></p>") // Returns "Hello world"
      
      export function stripHTML(html: string): string {
      if (typeof document === "undefined") {
      return html;
      }
      const tempDiv = document.createElement("DIV");
      tempDiv.innerHTML = html;
      return tempDiv.textContent || "";
      }