Module: GuardHelpers::MdHelper::ClassMethods

Defined in:
lib/guard_helpers/md_helper.rb

Instance Method Summary collapse

Instance Method Details

#anchor(name, url) ⇒ Object



9
10
11
# File 'lib/guard_helpers/md_helper.rb', line 9

def anchor(name, url)
  "[#{name}](#{url})"
end

#get_name(title) ⇒ Object



22
23
24
# File 'lib/guard_helpers/md_helper.rb', line 22

def get_name(title)
  title.split(" ").map(&:downcase).join("-")
end

#h2(title) ⇒ Object



13
14
15
# File 'lib/guard_helpers/md_helper.rb', line 13

def h2(title)
  "##<a name='#{get_name(title)}'></a> #{title}"
end

#h3(title) ⇒ Object



17
18
19
# File 'lib/guard_helpers/md_helper.rb', line 17

def h3(title)
  "###<a name='#{get_name(title)}'></a> #{title}"
end

#l(title) ⇒ Object



30
31
32
# File 'lib/guard_helpers/md_helper.rb', line 30

def l (title)
  list(title)
end

#l1(title) ⇒ Object



34
35
36
# File 'lib/guard_helpers/md_helper.rb', line 34

def l1 (title)
  list(title, 1)
end

#list(title, level = 0) ⇒ Object



38
39
40
41
# File 'lib/guard_helpers/md_helper.rb', line 38

def list (title, level=0)
  ref = "##{title.split(" ").map(&:downcase).join("-")}"
  "#{" "*4*level}- [#{title}](#{ref})"
end

#ref(url) ⇒ Object



26
27
28
# File 'lib/guard_helpers/md_helper.rb', line 26

def ref(url)
  "####[#{url}](#{url})"
end