Class: NvimConf::Utils::MarkdownFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/nvim_conf/utils/markdown_formatter.rb

Class Method Summary collapse

Class Method Details

.collapisible(summary, content) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/nvim_conf/utils/markdown_formatter.rb', line 5

def collapisible(summary, content)
  "    <details>\n      <summary>\n        \#{summary}\n      </summary>\n\n      \#{content}\n    </details>\n  FORMAT\nend\n"

.format_title(title, level: 0, indent: 0) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nvim_conf/utils/markdown_formatter.rb', line 21

def format_title(title, level: 0, indent: 0)
  prefix = [
    indent.positive? ? " " * indent : nil,
    level != 0 ? "#" * level : nil
  ].compact.join

  [
    prefix,
    "#{title}\n\n"
  ].compact.join(" ")
end

.separator(count: 2) ⇒ Object



17
18
19
# File 'lib/nvim_conf/utils/markdown_formatter.rb', line 17

def separator(count: 2)
  "\n" * count
end