parshap / html-linkify

Turn plain text links into safe HTML anchor elements
11 stars 5 forks source link

How to ignore links already part of an anchor? #2

Closed KyleAMathews closed 10 years ago

KyleAMathews commented 10 years ago

E.g. convert example.com but not google.com

You should go to example.com

Learn more about it from this <a href="https://www.google.com/search?q=example.com">Google query</a>
parshap commented 10 years ago

This module assumes the input is not guaranteed to be safe (e.g., may contain xss) and so any text is escaped (using html-escape). If you trust your input to not contain any malicious HTML, you could skip the escaping, but this module does not currently support that.

KyleAMathews commented 10 years ago

Ok, moving on then. Thanks :)

parshap commented 10 years ago

If you'd like to implement this there would be two changes needed:

  1. Add an option to not escape and if this option is set do not make calls to escape()
  2. Change the link detection to only find links within text nodes (e.g., not in the href attribute of an element)