mmd-ruby - MultiMarkdown for Ruby

A Ruby wrapper for Fletcher Penney's MultiMarkdown C library. Based on rmultimarkdown by Till Schulte-Coerne

How to use?

>> require 'mmd-ruby' or require 'mmd' or require 'multimarkdown' or require 'multimarkdown-ruby'

Parse (output HTML):
>> MultiMarkdown.new('Hello, world.').to_html
#=> "<p>Hello, world.</p>"

Parse with Extensions:
>> MultiMarkdown.new('_Hello World!_', :smart, :filter_html).to_html
#=> "<p><em>Hello World!</em></p>"

*Available Extensions:
:compatibility - Markdown compatibility mode (disables all other options)
:complete - Force complete document
:snippet - Force snippet only
:no_smart_quotes - Disable Smart quotes
:no_footnotes - Disable Footnotes
:no_anchors - Don't add anchors to headers, etc.
:filter_styles - Filter out style blocks
:filter_html - Filter out raw HTML
:process_html - Process Markdown inside HTML
:no_metadata - Don't parse Metadata
:obfuscate_email_addresses - Mask email addresses
:critic_markup_accept_all - CriticMarkup: Accept all proposed changes
:critic_markup_reject_all - CriticMarkup: Reject all proposed changes
:random_footnote_anchor_numbers - Use random numbers for footnote link anchors
:escaped_line_breaks - Escaped line breaks

Parse (output LaTeX):
>> MultiMarkdown.new('_Hello World!_').to_latex
#=> "\emph{Hello World!}"

Add Metadata:
>> doc = MultiMarkdown.new("Title: Some document  \n\nSome text in the document")

Extract All Metadata:
>> doc.metadata
#=> {"title" => "Some document"}

Extract Metadata Value by Key:
>> doc.metadata("Title")
#=> "Some document"

See the MultiMarkdown User's Guide for more information.

Installation

Install from Rubygems:

$ [sudo] gem install mmd-ruby

Bundle via Bundler:

gem 'mmd-ruby'

Changelog

Beware: The versioning scheme isn't based upon Semantic Versioning! The first three version numbers are inherited from the underlying C library. Only the last number is used to indicate changes in the Ruby wrapper itself.

  • 5.2.0.1: Initial Release. Based on MultiMarkdown 5.2.0.

License

MultiMarkdown and mmd-ruby are both licensed under the MIT License. See LICENSE for more information.