acts_as_markdown

by Brian Landau of Viget Labs <[email protected]>

GitHub Project: github.com/vigetlabs/acts_as_markdown

RDoc: viget.rubyforge.org/acts_as_markdown

DESCRIPTION:

Allows you to specify columns of an ActiveRecord model that contain Markdown text. You may then use to_s to get the original markdown text or to_html to get the formated HTML.

This AR extension can use 3 different types of Markdown processing backends: BlueCloth, RDiscount, or Ruby PEG. You specify which one you want to use by setting a config value in your environment.rb file:

ActsAsMarkdown.markdown_library = :bluecloth

By default RDiscount will be used.

EXAMPLE:

class Post < ActiveRecrod
  acts_as_markdown :body
end

@post = Post.find(:first)
@post.body.to_s     #=> "## Markdown Headline"
@post.body.to_html  #=> "<h2> Mardown Headline</h2>"

REQUIREMENTS:

You will also need to install some type of Markdown processor. The three options currently supported are:

INSTALL:

sudo gem install acts_as_markdown

Add “acts_as_markdown” to your environment.rb:

config.gem "acts_as_markdown"