Class: Md2Ansi::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/md2ansi/cli.rb

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



5
6
7
# File 'lib/md2ansi/cli.rb', line 5

def initialize
    @markdown = Redcarpet::Markdown.new(Ansi, :fenced_code_blocks => true)
end

Instance Method Details

#render(content) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/md2ansi/cli.rb', line 9

def render(content)
  if content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
    content = $'
  end

  @markdown.render(content)
end