0.0
No commit activity in last 3 years
No release in over 3 years
MailChimp flavoured markdown syntax using RedCarpet
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 3.0
~> 1.0
~> 1.0
 Project Readme

Our chimpy flavour of Redcarpet Markdown with a few escaping tricks for merge tags and content writer friendly extensions.

Use

Installation

In your Gemfile:

gem "mc_markdown", git: 'git@github.com:mailchimp/mc_markdown.git'

Then bundle install

Quick Examples

Rendering with the Base renderer

MCMarkdown.render "# Hello World"
# => '<h1>Hello World</h1>'

MCMarkdown.render "*|MERGE_TASTIC|*"
# => '<p>*|MERGE_TASTIC|*</p>'

MCMarkdown.render "[Sign Up {btn}](/signup)"
# => '<a href="/signup" class="btn">Sign Up</a>'

Getting a renderer to use

html = MCMarkdown::Renderers.use :html
# => MCMarkdown::HTML initialized for Redcarpet::Markdown

html.render '# Hello World'
# => '<h1>Hello World</h1>'

Can also extract frontmatter

frontmatter, html = MCMarkdown.render_with_frontmatter "---\nfoo:bar\n---\n\n# Hello World"
# => { "foo" => "bar" }, "<h1>Hello World\n"

Full Docs

Renderers
Our "top level" objects, they coordinate collections of formatters and take the #render method to render our input markdown.

Formatters
Formatters are the individual parts that differ from the base Redcarpet implementation. Some implement something like "shortag" codes in markdown.

Testing

$ rspec
# => runs the test suite

Contributing

If there is any thing you'd like to contribute or fix, please:

  • Fork the repo
  • Add tests for any new functionality
  • Make your changes
  • Verify all existing tests work properly
  • Make a pull request

License

The mc_markdown gem is distributed under the BSD 3.0 license.