### Home Classes Methods

### In Files

- lib/literati.rb

### Parent

Object

### Namespace

- CLASS Literati::MarkdownRenderer::GitHubWrapper

### Methods

- ::new
- #determine_markdown_renderer
- #installed?
- #to_html

### Class/Module Index

Quicksearch

- Literati
- Literati::MarkdownRenderer
- Literati::MarkdownRenderer::GitHubWrapper
- Literati::Renderer

No matching classes.

# Literati::MarkdownRenderer

A simple class to wrap passing the right arguments to RedCarpet.

### Public Class Methods

new(content) click to toggle source

Create a new compatibility instance.

content - The Markdown content to render.

    # File lib/literati.rb, line 28
    def initialize(content)
      @content = content
    end

### Public Instance Methods

determine_markdown_renderer() click to toggle source

    # File lib/literati.rb, line 32
    def determine_markdown_renderer
      @markdown = if installed?('github/markdown')
        GitHubWrapper.new(@content)
      elsif installed?('redcarpet/compat')
        Markdown.new(@content, :fenced_code, :safelink, :autolink)
      elsif installed?('redcarpet')
        RedcarpetCompat.new(@content)
      elsif installed?('rdiscount')
        RDiscount.new(@content)
      elsif installed?('maruku')
        Maruku.new(@content)
      elsif installed?('kramdown')
        Kramdown::Document.new(@content)
      elsif installed?('bluecloth')
        BlueCloth.new(@content)
      end
    end

installed?(file) click to toggle source

    # File lib/literati.rb, line 50
    def installed?(file)
      begin
        require file
        true
      rescue LoadError
        false
      end
    end

to_html() click to toggle source

Render the Markdown content to HTML. We use GFM-esque options here.

Returns an HTML string.

    # File lib/literati.rb, line 62
    def to_html
      determine_markdown_renderer
      @markdown.to_html
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.