@simon you can try stuff like github.com/cure53/DOMPurify. I am not sure that is the best one, but they exist (I wrote one, once upon a time).