Archive for redcloth

RedCloth Bug

Posted in Programming with tags , on April 29, 2008 by dialgforgerald

I just experienced this weird bug in RedCloth 3.0.4 where line breaks are not handled properly. I talked to a friend about it and found out that it was a known bug which, unfortunately, hasn’t been fixed yet. Anyway, you guys can try this patch until a new RedCloth version comes out which will hopefully fix this. Just change the hard_break function to:

text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks

And this is just another reason why it would be wise to freeze your gems.