Project

mtlite

0.0
No commit activity in last 3 years
No release in over 3 years
Martile Lite generates HTML ideally from 1 line of a condensed kind of markdown language.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.1.0, ~> 0.1
~> 2.1, >= 2.1.7.1
 Project Readme

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:

  • Making an unordered list into an Mtlite 1-liner list e.g. "a todo list:\n* line 1\n* line 2" => a todo list: [* line 1 * line 2]
  • Adding br tags to checklist items e.g. todo list: [[x] line 1 [] line 2] => todo list: <br/>[x] line 1 <br/>[] line 2
  • Convert square brackets to unicode check boxes; Replaces a [] with a unicode checkbox, and [x] with a unicode checked checkbox
  • Convert fractions using their associated unicode character i.e. 1/4, 1/2, 3/4
  • Adding strikethru to completed items e.g. -milk cow- becomes <del>milk cow</del>
  • Appending a domain label after the URL
  • Generate html lists from Mtlite 1-liner lists.

Examples

require 'mtlite'

MTLite.new("a todo list:\n* line 1\n* line 2").to_html
#=&gt; "a todo list: &lt;ul&gt;&lt;li&gt;line 1&lt;/li&gt;&lt;li&gt;line 2&lt;/li&gt;&lt;/ul&gt;\n" 

MTLite.new("todo list: [[x] line 1 [] line 2]").to_s
#=&gt; "todo list: \n☑ line 1\n� line 2\n" 

MTLite.new("todo list: [[x] line 1 [] line 2]").to_html
#=&gt; "todo list: &lt;br/&gt;☑ line 1&lt;br/&gt;� line 2\n" 

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

MTLite.new(" -milk cow- ").to_html
#=&gt; " &lt;del&gt;milk cow&lt;/del&gt;\n" 

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

Resources

mtlite gem markdown martile html