Class: Jazzy::JazzyHTML

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Includes:
Redcarpet::Render::SmartyPants, Rouge::Plugins::Redcarpet
Defined in:
lib/jazzy/jazzy_markdown.rb

Constant Summary collapse

OPTIONS =
{
  autolink: true,
  fenced_code_blocks: true,
  no_intra_emphasis: true,
  quote: true,
  strikethrough: true,
  space_after_headers: true,
}.freeze

Instance Method Summary collapse

Instance Method Details

#header(text, header_level) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jazzy/jazzy_markdown.rb', line 14

def header(text, header_level)
  text_slug = text.gsub(/[^a-zA-Z0-9]+/, '_')
    .downcase
    .sub(/^_/, '')
    .sub(/_$/, '')

  "<a href='##{text_slug}' class='anchor' aria-hidden=true>" \
    '<span class="header-anchor"></span>' \
  '</a>' \
  "<h#{header_level} id='#{text_slug}'>#{text}</h#{header_level}>\n"
end

#paragraph(text) ⇒ Object



10
11
12
# File 'lib/jazzy/jazzy_markdown.rb', line 10

def paragraph(text)
  "<p class=\"para\">#{text}</p>"
end