Every repository with this icon (
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Wed Aug 06 14:32:20 -0700 2008 | |
| |
History.txt | Wed Aug 06 14:49:48 -0700 2008 | |
| |
LICENSE.txt | Fri Aug 08 19:50:48 -0700 2008 | |
| |
Manifest.txt | ||
| |
README.rdoc | ||
| |
Rakefile | ||
| |
acts_as_markup.gemspec | ||
| |
lib/ | ||
| |
tasks/ | Wed Aug 06 14:51:37 -0700 2008 | |
| |
test/ |
acts_as_markup
by Brian Landau of Viget Labs <brian.landau@viget.com>
GitHub Project: github.com/vigetlabs/acts_as_markup
RDoc: viget.rubyforge.org/acts_as_markup
DESCRIPTION:
Allows you to specify columns of an ActiveRecord model that contain Markdown or Textile text. You may then use to_s to get the original markdown or textile 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:
ActsAsMarkup.markdown_library = :bluecloth
By default RDiscount will be used.
EXAMPLES:
Using acts_as_markdown:
class Post < ActiveRecrod
acts_as_markdown :body
end
@post = Post.find(:first)
@post.body.to_s #=> "## Markdown Headline"
@post.body.to_html #=> "<h2> Markdown Headline</h2>"
Using acts_as_textile:
class Post < ActiveRecrod
acts_as_textile :body
end
@post = Post.find(:first)
@post.body.to_s #=> "h2. Markdown Headline"
@post.body.to_html #=> "<h2>Markdown Headline</h2>"
Using acts_as_markup:
class Post < ActiveRecrod
acts_as_markup :language => :markdown, :columns => [:body]
end
@post = Post.find(:first)
@post.body.to_s #=> "## Markdown Headline"
@post.body.to_html #=> "<h2> Markdown Headline</h2>"
REQUIREMENTS:
You will need the RedCloth library for processing the Textile text.
You will also need to install some type of Markdown processor. The three options currently supported are:
INSTALL:
sudo gem install acts_as_markup
Add "acts_as_markup" to your environment.rb:
config.gem "acts_as_markup"








