My rails app is using RDiscount to generate HTML from user-supplied markdown text, and I noticed that the anchor tags don't have rel="nofollow". This is a big issue for me as my app is open to the public. Is there a way to enable nofollow links, or are there better solutions?
Thanks!
I needed to do something similar, add
target="_new"
to all links. Solved it using Kramdown and a customKramdown::Converter::Html
class.Define a
Kramdown::Converter::Html
subclass (kramdown/converter/my_html.rb in some autoload path)I also have a view helper in app/helpers/application_helper.rb
Ideally it should be possible to just use
Kramdown::Document.new(str).to_my_html.html_safe
but I can't get it to work in rails development mode as Kramdown usesconst_defined?
to see if a converter is available and that does not trigger the autoloader. Please comment if you know how to fix this.