Closed choxnox closed 10 years ago
Hey choxnox, how are you looking to specify this? Would a rel
option that applies the "rel" attribute to all generated anchor tags work? Or are you looking for more control that you can specify it on a per-anchor basis?
I'd like this too.
For now, I pipe the output through jQuery to do it reliably, but obviously it's a little heavy because it has to create a dom and such.
var retHtml = Autolinker.link(html, {newWindow: false, stripPrefix: false, truncate: 100, twitter: false, className: 'autolinked'});
var retSel = $($.parseHTML('<div class="autolink-outer-wrapper"><div class="autolink-inner-wrapper">'+retHtml+'</div><div>'));
retSel.find('a.autolinked').attr('rel', 'nofollow');
var newHtml = retSel.find('.autolink-inner-wrapper').first().html();
Have a fix here: 02f2e81a1f6718b47b46c17718599404f2b7020c
Finally possible using replaceFn
! Example:
var html = Autolinker.link( text, {
replaceFn : function( autolinker, match ) {
var tag = autolinker.getTagBuilder().build( match ); // Returns an Autolinker.HtmlTag instance
tag.setAttr( 'rel', 'nofollow' );
return tag;
}
} );
It would be great for user-managed content to have an option to enable/disable
rel
attribute, and more specifically it'snofollow
attribute.