Class: RDiscount

### Home Classes Methods

### In Files

- lib/rdiscount.rb

### Parent

Object

### Methods

- ::new

### Files

- COPYING

### Class/Module Index

Quicksearch

- Object
- RDiscount

No matching classes.

# RDiscount

Discount is an implementation of John Gruber’s Markdown markup language in C. It implements all of the language as described in Markdown Syntax and passes the Markdown 1.0 test suite. The RDiscount extension makes the Discount processor available via a Ruby C Extension library.

## Usage

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

    require 'rdiscount'
    markdown = RDiscount.new("Hello World!")
    puts markdown.to_html

## Replacing BlueCloth

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

    begin
      require 'rdiscount'
      BlueCloth = RDiscount
    rescue LoadError
      require 'bluecloth'
    end

### Constants

VERSION

### Attributes

autolink[RW]

Convert URL in links, even if they aren’t encased in `<>`

filter_html[RW]

Do not output any raw HTML included in the source text.

filter_styles[RW]

Do not output `<style>` tags included in the source text.

fold_lines[RW]

RedCloth compatible line folding – not used for Markdown but included for compatibility.

no_image[RW]

Do not process `![]` and remove `<img>` tags from the output.

no_links[RW]

Do not process `[]` and remove `<a>` tags from the output.

no_pseudo_protocols[RW]

Do not process pseudo-protocols like `[](id:name)`

no_tables[RW]

Do not process tables

safelink[RW]

Don’t make hyperlinks from `[][]` links that have unknown URL types.

smart[RW]

Set true to have smarty-like quote translation performed.

strict[RW]

Disable superscript and relaxed emphasis processing.

text[R]

Original Markdown formatted text.

### Public Class Methods

new(text, *extensions) click to toggle source

Create a RDiscount Markdown processor. The `text` argument should be a string containing Markdown text. Additional arguments may be supplied to set various processing options:

- `:smart` - Enable SmartyPants processing.

- `:filter_styles` - Do not output `<style>` tags.

- `:filter_html` - Do not output any raw HTML tags included in the source text.

- `:fold_lines` - RedCloth compatible line folding (not used).

- `:generate_toc` - Enable Table Of Contents generation

- `:no_image` - Do not output any `<img>` tags.

- `:no_links` - Do not output any `<a>` tags.

- `:no_tables` - Do not output any tables.

- `:strict` - Disable superscript and relaxed emphasis processing.

- `:autolink` - Greedily urlify links.

- `:safelink` - Do not make links for unknown URL types.

- `:no_pseudo_protocols` - Do not process pseudo-protocols.

    # File lib/rdiscount.rb, line 87
    def initialize(text, *extensions)
      @text  = text
      extensions.each { |e| send("#{e}=", true) }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.