I need the following features:
- hard-wrap text
- auto link (make urls into clickable links)
- @name should turn into links to user/show action (I should be able to write this helper method)
- prevent code injection
As far as I've learned, redcarpet doesn't seem to work properly, and I found redcloth to be the choice. But it seems a little outdated, and it doesn't provide filter_html or autolink options. I could install gems sanitize and autolink to use with redcloth but I believe there would be a better way.
Can anyone give me suggestions?
I'd recommend checking out the html-pipeline gem. It has filters for doing a lot of what you want and includes:
MentionFilter- replace@usermentions with linksAutolinkFilter- auto_linking urls in HTMLCamoFilter- replace http image urls with camo-fied https versionsEmailReplyFilter- util filter for working with emailsEmojiFilter- everyone loves emoji!HttpsFilter- HTML Filter for replacing http github urls with https versions.ImageMaxWidthFilter- link to full size image for large imagesMarkdownFilter- convert markdown to htmlPlainTextInputFilter- html escape text and wrap the result in a divSanitizationFilter- whitelist sanitize user markupSyntaxHighlightFilter- code syntax highlighter with linguistTextileFilter- convert textile to htmlTableOfContentsFilter- anchor headings with name attributes