开发者

ruby (on rails) gem for basic form markup

I'd like to add开发者_开发技巧 some basic markup (bbcode and so on) for an app I'm working on. I need not more than basic functionality such as [b], [url] and tags like that.

Can you recommend a gem that is easy to drop in?

EDIT: I got a tip to use RDiscount, which is what I installed and am now trying to use. I am however unsure how to use it. My first idea was to use it in a :before_save filter in my model, but that means I would be saving the HTML to my database. This means if I want to edit the content there would be a bunch of HTML-tags showing for the user.

Another idea I had was to create a helper method in app/helpers/application_helper which would could return HTML to the views by calling helper_name(post.content). This would probably the best idea, and it seems to work (partially). Ruby on Rails still prevents any HTML to be "used" as it escapes the tags.

Do you recommend some other way to use it? If not, how can I "unescape" the HTML?


Something like RDiscount, perhaps? Not clear what your requirements are, but here's info about the project.


formtastic is a very popular and powerful plugin for this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜