Module: Render::Markdown

Defined in:
action/lib/render/markdown.rb

Overview

Small Markdown escaping and display helpers shared by renderers.

Class Method Summary collapse

Class Method Details

.display_version(value) ⇒ Object



17
18
19
20
# File 'action/lib/render/markdown.rb', line 17

def display_version(value)
  text = value.to_s
  text.match?(/\A[0-9a-f]{40}\z/i) ? text[0, 7] : text
end

.inline_code(value) ⇒ Object



8
9
10
11
# File 'action/lib/render/markdown.rb', line 8

def inline_code(value)
  text = value.to_s
  text.include?("`") ? "``#{text}``" : "`#{text}`"
end

.table_cell(value) ⇒ Object



13
14
15
# File 'action/lib/render/markdown.rb', line 13

def table_cell(value)
  value.to_s.gsub("|", "\\|").gsub("\n", "<br>")
end