https://github.com/mailchimp/mc_markdown
gem for mailchimp flavoured markdown
https://github.com/mailchimp/mc_markdown
Last synced: 11 months ago
JSON representation
gem for mailchimp flavoured markdown
- Host: GitHub
- URL: https://github.com/mailchimp/mc_markdown
- Owner: mailchimp
- License: bsd-3-clause
- Created: 2013-04-15T14:17:38.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2014-12-15T21:43:06.000Z (over 11 years ago)
- Last Synced: 2025-07-28T03:10:33.324Z (11 months ago)
- Language: Ruby
- Homepage:
- Size: 576 KB
- Stars: 7
- Watchers: 25
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
Our chimpy flavour of [Redcarpet](https://github.com/vmg/redcarpet) Markdown with a few escaping tricks for merge tags and content writer friendly extensions.
# Use
### Installation
In your Gemfile:
```ruby
gem "mc_markdown", git: 'git@github.com:mailchimp/mc_markdown.git'
```
Then `bundle install`
### Quick Examples
Rendering with the Base renderer
```ruby
MCMarkdown.render "# Hello World"
# => '
Hello World
'
MCMarkdown.render "*|MERGE_TASTIC|*"
# => '
*|MERGE_TASTIC|*
'
MCMarkdown.render "[Sign Up {btn}](/signup)"
# => 'Sign Up'
```
Getting a renderer to use
```ruby
html = MCMarkdown::Renderers.use :html
# => MCMarkdown::HTML initialized for Redcarpet::Markdown
html.render '# Hello World'
# => '
Hello World
'
```
Can also extract frontmatter
```ruby
frontmatter, html = MCMarkdown.render_with_frontmatter "---\nfoo:bar\n---\n\n# Hello World"
# => { "foo" => "bar" }, "
Hello World\n"
```
### Full Docs
**[Renderers](doc/renderers.md)**
Our "top level" objects, they coordinate collections of formatters and take the `#render` method to render our input markdown.
**[Formatters](doc/formatters.md)**
Formatters are the individual parts that differ from the base [Redcarpet](https://github.com/vmg/redcarpet) implementation. Some implement something like "shortag" codes in markdown.
# Testing
```bash
$ 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](/LICENSE).