mathiasbynens / he

A robust HTML entity encoder/decoder written in JavaScript.
https://mths.be/he
MIT License
3.43k stars 255 forks source link

Allow to ignore specific elements in the string, like code #78

Closed lukasoppermann closed 2 years ago

lukasoppermann commented 3 years ago

Hey,

I would love an option to ignore certain parts of a string from decoding.

My use case is that I want to decode encoded html in a string, however there is also escaped html within a code element which I would like to not decode (as this will render it invisible).

I have no idea of how to do this with the current setup, is this possible, or could an option for this be added?

evanjmg commented 2 years ago

@lukasoppermann find any solution for this? Running into the same thing.

lukasoppermann commented 2 years ago

Not really, but I am not actively using this package. Sorry.

evanjmg commented 2 years ago

@lukasoppermann found a solution DOMpurify does all of this and has tons of support. https://github.com/cure53/DOMPurify