Module: Hamdown::MdHandler

Defined in:
lib/hamdown/md_handler.rb

Overview

Module to recognize markdown patterns in text and compile it to html

Constant Summary collapse

OBJECTS =

list of objects with rules: how to recognize markdown patterns by reg_ex how to replace it by html

[
  # lists should be before fonts
  MdRegs::OList,
  MdRegs::UList,
  MdRegs::Headers,
  MdRegs::Images,
  MdRegs::Code,
  # font should be before fonts2
  MdRegs::Fonts,
  MdRegs::Fonts2,
  MdRegs::Quotes
].freeze

Class Method Summary collapse

Class Method Details

.perform(text = '') ⇒ Object

render text (haml + html) to html



32
33
34
35
36
37
# File 'lib/hamdown/md_handler.rb', line 32

def self.perform(text = '')
  OBJECTS.each do |object|
    text = object.new.perform(text)
  end
  text
end