stripTags

Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.html

Strip tags of an html string. This is a simple wrapper of the nice “striptags” package that you can find here: https://www.npmjs.com/package/striptags

Params

  1. html*-String

    The html string to process

  2. allowedTags*-String[]

    The tags that are allowed like [‘a’,‘p’,‘h1’,‘h2’]…

  3. tagReplacement*-String

    A string with which you want to replace the tags

Return

  1. -String

    The processed string without tags

Example

import { stripTags } from '@blackbyte/sugar/html'
stripTags('<p><span>Hello</span> world</p>', '<span>') // <span>Hello</span> world

Todo

  • testsnormal