leizongmin / js-xss

Sanitize untrusted HTML (to prevent XSS) with a configuration specified by a Whitelist
http://jsxss.com
Other
5.16k stars 633 forks source link

new line characters filtered out #241

Closed ittybittykitty closed 2 years ago

ittybittykitty commented 2 years ago

Hello! I have sample text with a new line character in it, is there a way to convert the character to an HTML line break or prevent it form being removed?

'Hello,\nThis is a test string with a new line character.'

actual output: 'Hello,This is a test string with a new line character.'

expected output: 'Hello,\nThis is a test string with a new line character.' or 'Hello,<br>This is a test string with a new line character.'

ittybittykitty commented 2 years ago

Hi! I realized this is only an issue with some tags, when the are at the beginning of a string, but I don't think that is an issue for my use case so I am closing this.