Home Account

michelf markdown rel = nofollow

2013-12-18 16:38 dennis iversen

Tags: php scripts-and-functions

I have been using the michelf markdown transformer for a long time now, and I would like to use it in comment system. There is no way to tell the parser to add attributes to a link (like the rel="nofollow", but it is faily easy to extend the class and override the methods which does the link parsing.

You will need to override the following two methods: _doAnchors_reference_callback and _doAnchors_inline_callback

I added the following filter to an old php framework, and called it markdownNoFollow. This class will add the rel="nofollow" attribute to links.

This page has been requested 4123 times