Class: MarkdownConverter

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/gitdocs/markdown_converter.rb

Overview

Singleton markdown converter, configured with github favoured markdown

adapted from (github.com/chitsaou/ruby-taiwan/blob/d342b58dcfff3089a9599714a6911ca9c1f1490f/config/initializers/markdown.rb)

Defined Under Namespace

Classes: HTMLwithSyntaxHighlight

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.convert(text) ⇒ Object



21
22
23
# File 'lib/gitdocs/markdown_converter.rb', line 21

def self.convert(text)
  self.instance.convert(text)
end

Instance Method Details

#convert(text) ⇒ Object



25
26
27
28
# File 'lib/gitdocs/markdown_converter.rb', line 25

def convert(text)
  text = text.force_encoding('utf-8') if text.respond_to?(:force_encoding)
  @converter.render(text)
end