Home Account

michelf markdown rel = nofollow

18-Dec-2013 16:38:21 dennis

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 the CosCMS framework, and called it markdownNoFollow. This class will add the rel="nofollow" attribute to links.