Skip to content

Commit

Permalink
Initial support for ignoreTags option
Browse files Browse the repository at this point in the history
This can be used to tell linkify to ignore certain tags
  • Loading branch information
nfrasser committed Apr 17, 2016
1 parent ff7ee36 commit e474b1d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/linkify/utils/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ function typeToTarget(href, type) {
function normalize(opts) {
opts = opts || {};
let newLine = opts.newLine || false; // deprecated
let ignoreTags = opts.ignoreTags || [];

// Make all tags names upper case
for (var i = 0; i < ignoreTags.length; i++) {
ignoreTags[i] = ignoreTags[i].toUpperCase();
}

return {
attributes: opts.linkAttributes || null,
defaultProtocol: opts.defaultProtocol || 'http',
Expand All @@ -24,7 +31,8 @@ function normalize(opts) {
nl2br: !!newLine || opts.nl2br || false,
tagName: opts.tagName || 'a',
target: opts.target || typeToTarget,
linkClass: opts.linkClass || 'linkified'
linkClass: opts.linkClass || 'linkified',
ignoreTags: ignoreTags
};
}

Expand Down

0 comments on commit e474b1d

Please sign in to comment.