Skip to content

Latest commit

 

History

History
58 lines (38 loc) · 1.85 KB

README.rdoc

File metadata and controls

58 lines (38 loc) · 1.85 KB

markup

This gem provides a simple, centralized interface for translation of markup from one format to another. It comes with a bunch of processors, and handles requirement of optional dependencies as configured needed.

Configuration

There are several defaults that can set for the library:

from

Default format from which to translate the source.

Default: :plain_text

Possible Values: :plain_text, :html

to

Default format to which to translate the source.

Default: :html

Possible Values: :plain_text, :html

prefix

Default string to prepend to the name of the source field to come up with the name of the target field. This can be used in conjunction with the :suffix option, but is disregarded if the :target option is used. Use false to disable.

Default: false

Possible Values: "_rendered", "_html", false

suffix

Default string to append to the name of the source field to come up with the name of the target field. This can be used in conjunction with the :prefix option, but is disregarded if the :target option is used. Use false to disable.

Default: "_rendered"

Possible Values: "_rendered", "_html", false

The configuration block can be added to your initialization scripts. For Rails applications, this can be added to an initializer.

Markup.configuration do |config|
  config.from :plain_text
  config.to :html
end

Usage

Markup.translate(text)
Markup.translate(text, :from => :markdown, :to => :html)

Rails Support

Support for Rails in available in the markup-rails gem.

Copyright © 2011 Kristina Lim. Licensed under the MIT License. See LICENSE.txt for further details.