This repository has been archived by the owner. It is now read-only.
GreenCloth lightweight markup language (an extension to RedCloth with additions for wikis)
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



GreenCloth is derived from RedCloth, the defacto text to html converter for ruby.

The purpose of GreenCloth is to add a bunch of new features to RedCloth that make
it more suited for wiki markup.

GreenCloth requires that RedCloth version > 4.0 is installed and that prior
versions are NOT installed.

Changes from RedCloth

New markup:

  • Crabgrass style links (eg [riseup ->])
  • Autolinks
  • Markdown blockquotes (>)
  • Setext headers
    (h1 is formed by under line with ====, h2 underline with ----)
  • Allow embedded video tags, and sanitize these embeds.
  • Tables can use tabs in addition to pipes (|)
  • Insert table of contents with [[toc]]
  • Add unique clickable anchors to each heading (if to_html is passed option :outline)
  • Pass an optional callback block for rendering links (allows for dead link rendering)
  • Additional way to specify code blocks

See SYNTAX_REFERENCE for more information.


Example usage

You can use greencloth like so:

greencloth =, context_name, [:outline])
greencloth.to_html takes three argument:

  • The raw greencloth markup text
  • The context name for resolving links. The path for links are prefixed with this context.
  • an array of greencloth options. useful options include:
    • :outline — turn on the generation of outline data and markup.
    • :lite_mode — disable blocks, only allow some markup.

Passing a block to to_html()

Greencloth.to_html can take a block. The block is passed data regarding every link
that it encounteres while processing links.

You can use this to do custom rendering of links. For example:

html =,'mygroup').to_html() do |link_data|

process_link should return either nil or an <a> tag. If nil, then the greencloth
default is used.

link_date is a hash that might include: url, label, context_name, page_name


To run the all the tests:

rake test

Or to test the markup from a specific fixture:

ruby test/markup_test.rb test/fixtures/images.yml


sometimes the header detection for editing inline fails.