Introducing the Mtlite gem

The Mtlite gem was inspired by the Martile gem to facilitate transforming a kind of a loose Martile markdown.

It features the following:

"a todo list:\n* line 1\n* line 2" =>   a todo list: [* line 1 * line 2]
todo list: [[x] line 1 [] line 2] =>  todo list: <br/>[x] line 1 <br/>[] line 2

Examples

require 'mtlite'

MTLite.new("a todo list:\n* line 1\n* line 2").to_html
#=> "a todo list: <ul><li>line 1</li><li>line 2</li></ul>\n" 

MTLite.new("todo list: [[x] line 1 [] line 2]").to_s
#=> "todo list: \n☑ line 1\n☐ line 2\n" 

MTLite.new("todo list: [[x] line 1 [] line 2]").to_html
#=> "todo list: <br/>☑ line 1<br/>☐ line 2\n" 

MTLite.new("2 apples and 1/2 teaspoon of cinamon powder").to_s
#=> "2 apples and ½ teaspoon of cinamon powder\n" 

MTLite.new(" -milk cow- ").to_html
#=> " <del>milk cow</del>\n" 

MTLite.new(" find out more from http://news.bbc.co.uk").to_html
#=> " find out more from <a target=\"_blank\" href=\"http://news.bbc.co.uk\">http://news.bbc.co.uk</a>\n"

Resources

Tags:
Source:
1923hrs.txt
Published:
03-06-2014 19:23