markdown-expander
Adds some new syntax to markdown
Installation
Add this line to your application's Gemfile:
gem 'markdown-expander'
And then execute:
$ bundle
Or install it yourself as:
$ gem install markdown-
Expressions
require "markdown-expander"
MarkdownExpander::Expander.new(
"# Title: {{thing.title}}"
).render(
thing: {title: "Hello"}
)
#=> "# Title: Hello"
Loops
require "markdown-expander"
template = "{{thing in stuff}}\n# {{thing.title}}\n{{end}}\n"
MarkdownExpander::Expander.new(template).render(
stuff: [ {title: "First!"}, {title: "Second!"} ]
)
#=> "# First!\n# Second!\n"