Express Sweet API Reference - v3.0.0
    Preparing search index...
    • Removes HTML tags from a string, optionally allowing specific tags.

      Parameters

      • str: string

        The string to remove HTML tags from.

      • allowedTags: string | string[] = []

        An array of allowed HTML tags. Default is an empty array.

      • replacement: string = ''

        The string to replace HTML tags with. Default is blank.

      Returns string

      The string with HTML tags removed.

      {{!-- results in: lorem ipsum dolor sit amet --}}
      {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>'}}}

      {{!-- results in: lorem ipsum <strong>dolor</strong> sit amet --}}
      {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' '<strong>' ''}}}

      {{!-- results in: 🍩lorem ipsum 🍩dolor🍩 🍩sit🍩 amet🍩 --}}
      {{{stripTags '<a href="https://example.com">lorem ipsum <strong>dolor</strong> <em>sit</em> amet</a>' [] '🍩'}}}