Class: Noteman::MDProcessor::StackRenderer

Inherits:
Redcarpet::Render::Base
  • Object
show all
Defined in:
lib/noteman/md_processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStackRenderer

Returns a new instance of StackRenderer.



7
8
9
10
# File 'lib/noteman/md_processor.rb', line 7

def initialize
  super
  @items = []
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



5
6
7
# File 'lib/noteman/md_processor.rb', line 5

def items
  @items
end

Instance Method Details

#header(title, level) ⇒ Object



12
13
14
15
# File 'lib/noteman/md_processor.rb', line 12

def header(title, level)
  items << { :text => title, :level => level, :type => :header }
  "#{'#' * level} #{title}\n\n"
end

#paragraph(text) ⇒ Object



17
18
19
20
# File 'lib/noteman/md_processor.rb', line 17

def paragraph(text)
  items << { :text => text, :type => :paragraph }
  "#{text}\n\n"
end