Collection of filters that transform plain text into HTML code.
Collection of filters that transform plain text into HTML code.
AutoHtml is a collection of filters that transforms plain text into HTML code. See live demo.
Add this line to your application's Gemfile:
gem 'auto_html'And then execute:
$ bundleOr install it yourself as:
$ gem install auto_htmlAutoHtml uses concepts found in "Pipes and Filters" processing design pattern:
Filter - transforms an input. In AutoHtml context, this is any object that does the transformation through #call(String) method. Filter options should be passed in initializer. AutoHtml provides some filters already, ie Link, Image, Markdown, etc.Pipeline - a composition of filters that transforms input by passing the output of one filter as input for the next filter in line. In AutoHtml context, this is the AutoHtml::Pipeline class. Since the same interface (method #call) is used to pass input, we can say that Pipeline is just another Filter, which means it can be used as a building block for other Pipelines, in a mix with other filters.…Bellow is the list of bundled filters along with their optional arguments on initialization and their default values.
AutoHtml::EmojiAutoHtml::HtmlEscapeAutoHtml::Image, proxy: nil, alt: nilAutoHtml::Link, target: nil, rel: nilAutoHtml::MarkdownAutoHtml::SimpleFormatFor performance reasons it's a good idea to store the formated output in the database, in a separate column, to avoid generating the same content on each access. This can be acomplished simply by overriding the attribute writter:
class Comment '
Hey!
'bundle installrake rubocoprake specAutoHtml is released under the MIT License.
No open issues yet, or sync has not completed.