module Brainstem::ApiDocs::Formatters::Markdown::Helper

Public Instance Methods

md_a(text, link) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 57
def md_a(text, link)
  "[#{text}](#{link})"
end
md_code(text, lang = "") click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 41
def md_code(text, lang = "")
  "```#{lang}\n#{text}\n```\n\n"
end
md_h1(text) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 9
def md_h1(text)
  "# #{text}\n\n"
end
md_h2(text) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 13
def md_h2(text)
  "## #{text}\n\n"
end
md_h3(text) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 17
def md_h3(text)
  "### #{text}\n\n"
end
md_h4(text) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 21
def md_h4(text)
  "#### #{text}\n\n"
end
md_h5(text) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 25
def md_h5(text)
  "##### #{text}\n\n"
end
md_hr() click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 33
def md_hr
  "-----\n\n"
end
md_inline_code(text) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 45
def md_inline_code(text)
  "`#{text}`"
end
md_inline_type(type, item_type = nil) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 61
def md_inline_type(type, item_type = nil)
  return "" if type.blank?

  text = type.to_s.capitalize
  text += "<#{item_type.to_s.capitalize}>" if item_type.present?
  " (#{md_inline_code(text)})"
end
md_li(text, indent_level = 0) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 53
def md_li(text, indent_level = 0)
  "#{' ' * (indent_level * 4)}- #{text}\n"
end
md_p(text) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 37
def md_p(text)
  text + "\n\n"
end
md_strong(text) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 29
def md_strong(text)
  "**#{text}**"
end
md_ul(&block) click to toggle source
# File lib/brainstem/api_docs/formatters/markdown/helper.rb, line 49
def md_ul(&block)
  (instance_eval(&block) || "") + "\n\n"
end