decode-non-syntax-entities
v1.0.0
Published
Decode character escapes except for HTML syntax characters
Downloads
3
Maintainers
Readme
decode-non-syntax-entities
Decode character escapes except for HTML syntax characters, for example <
and &
const decodeNonSyntaxEntities = require('decode-non-syntax-entities');
decodeNonSyntaxEntities("<p title='rock'n'roll'> >_< </p>");
//=> "<p title='rock'n'roll'> >_< </p>"
Other decoder libraries usually produce a broken HTML in this case:
otherDecoder("<p title='rock'n'roll'> >_< </p>");
//=> "<p title='rock'n'roll'> >_< </p>"
Installation
npm install decode-non-syntax-entities
API
const decodeNonSyntaxEntities = require('decode-non-syntax-entities');
decodeNonSyntaxEntities(html)
html: string
Return: string
It works like he's decode
method, but does't decode the following entities:
"
references"
"
"
&
references&
&
&
'
references'
'
'
<
references<
<
<
>
references>
>
>
decodeNonSyntaxEntities('!!!');
//=> '!!!'
decodeNonSyntaxEntities('&&&');
//=> '&&&'
License
ISC License © 2018 Shinnosuke Watanabe