linkifyjs icon indicating copy to clipboard operation
linkifyjs copied to clipboard

linkify-html tries to parse empty tags

Open iskrenvankov opened this issue 3 years ago • 2 comments

Hi, when using linkify-html I've run into the following issue:

Example input: Foo/Bar <> Zoo/Zar

Expected output: same as the input (no change)

Observed output: Foo/Bar <zoo></zoo>

iskrenvankov avatar Dec 23 '21 21:12 iskrenvankov

Hi @iskrenvankov, this is an issue with Linkify's HTML parser simple-html-tokenizer. I'd suggest filing this issue there or escaping your input before passing it to Linkify:

linkifyHtml(input.replace(/<>/g, '&lg;&gt;'))

nfrasser avatar Dec 26 '21 15:12 nfrasser

Hi @nfrasser thanks for the suggestion, in the end I did end up doing precisely that. Still, I'll raise it with simple-html-tokenizer.

iskrenvankov avatar Dec 26 '21 18:12 iskrenvankov