oalders / html-restrict

HTML::Restrict - Strip away unwanted HTML tags
Other
10 stars 9 forks source link

Facility to add rel=nofollow #21

Open isync opened 8 years ago

isync commented 8 years ago

When restricting (or better, allowing) a href I think it would make sense to have a facility to add attributes to filtered tags. For example, as with href, to be able to enforce adding the rel="nofollow" attribute to outbound links. ...As it so nicely demotivates spammers, although I hear many search-engines interpret (in a way) these links nevertheless. As I see it, as of now, I would have to unleash another HTML::Parser run onto things already filtered by H::P in your module - or do it with some dirty regex, which is my current hotfix.

Please bear with me, I know, everyone hates people nagging with their wishlist stuff. Great module, am using it all over. Thanks Olaf!

oalders commented 8 years ago

@isync thanks for the feedback. Glad you're finding it to be helpful. :)

I suppose we could consider adding some kind of a post-processing callback as long as it didn't complicate the existing code too much. At this point I'd be more inclined to accept a pull request rather than to do it myself, but I'd be open to it.

My intention here was really to strip content rather than to mangle it, but I can see how that would be helpful.