Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Discount (For Ruby) Implementation of John Gruber's Markdown

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 ext
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 COPYING
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 moredown.gemspec

Moredown - Discount Markdown Processor for Ruby (with some extras)

Discount is an implementation of John Gruber's Markdown markup language in C. It implements all of the language described in the markdown syntax document and passes the Markdown 1.0 test suite.

Discount was developed by David Loren Parsons. The Ruby extension was developed by Ryan Tomayko and extended by Nathan Hoad.

Installation, Hacking

The Moredown gem can be installed from Rubygems:

$ gem install moredown

The Moredown sources are available via Git:

$ git clone git://
$ cd moredown
$ rake --tasks

For more information, see the project page.


Moredown can be used in any way that RDiscount can be (see below). In addition, Moredown implements some extras:

  • Static method for simple calls

    require 'moredown'
    html = Moredown.text_to_html("Hello World!")
  • Remap relative URLs, :base_url => '').to_html
  • Remap headings (eg. h1 becomes h3)., :map_headings => 2)
  • Embed Youtube videos (similar to image syntax except the title text is used for width and height)

    ![Blah](youtube:lfAzVe5H-vE "400 300")
  • Use Flash movies (include the width and height if you want)

    ![Something](flash:something.swf "200 100")
  • Use SwfObject (javascript not included) for graceful Flash degradation, :swfobject => { :src => 'swfobject.js', :version => '10', :fallback => 'No Flash' })
  • Image alignments (extension to image syntax)

  • Emoticons

  • RDiscount extensions are now passed under :extensions, :extensions => [:smart])

RDiscount implements the basic protocol popularized by RedCloth and adopted by BlueCloth:

require 'moredown'
markdown ="Hello World!")
puts markdown.to_html

Inject Moredown into your BlueCloth-using code by replacing your bluecloth require statements with the following:

  require 'moredown'
  BlueCloth = Moredown
rescue LoadError
  require 'bluecloth'


Discount is free software; it is released under a BSD-style license that allows you to do as you wish with it as long as you don't attempt to claim it as your own work. RDiscount adopts Discount's license verbatim. See the file COPYING for more information.

Something went wrong with that request. Please try again.