vigetlabs/acts_as_markup

How can I redefine the "to_html" method?

RogerPodacter opened this issue · 1 comments

I want to do some processing on my markdown before outputting it (converting newlines to <br>s, etc) and so I want to hook into the to_html method. How can I do this?

You can't, I suggest you either modify the markdown text on it's way into the datastore or modify the result of the to_html in a helper method. You could modify the incoming text either by modifying the setter attribute= method, or by having a before_save hook that modifies it. You could create a helper method to modify the HTML result of the to_html call either in the model or as view helper method in a helper module.