linkifyjs icon indicating copy to clipboard operation
linkifyjs copied to clipboard

Ignore elements with specifed class

Open artemijan opened this issue 8 years ago • 2 comments

is there an option to ignore not a tag but some class name for example. i just want not to linkify for example all <span class="link-removed-by-user">google.com</span>?

artemijan avatar Jan 04 '17 14:01 artemijan

Unfortunately ignoring by tag name is currently the only option. If you want to ignore specific domains, you can use the validate option:

'www.google.com'.linkify({
  validate: {
    url: function (value) {
      // Ignore URLs containing "google.com"
      return !(/google\.com/).test(value);
    }
  }
});

I'm open to adding an "ignore-by-CSS-selector" option. Pull requests welcome!

nfrasser avatar Jan 05 '17 02:01 nfrasser

Thanks for quick reply, you guys do a great job!

artemijan avatar Jan 06 '17 08:01 artemijan