Class: YARD::APIPlugin::Markup::RedcarpetDelegate

Inherits:
Object
  • Object
show all
Defined in:
lib/yard-api/markup/redcarpet.rb

Overview

TODO: make this configurable

Constant Summary collapse

Extensions =
{
  no_intra_emphasis: true,
  fenced_code_blocks: true,
  autolink: true,
  tables: true,
  lax_spacing: false,
  space_after_headers: true,
  underline: true,
  highlight: true,
  footnotes: true
}.freeze
RendererOptions =
{
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(text, extensions_and_options = nil) ⇒ RedcarpetDelegate

Returns a new instance of RedcarpetDelegate.



22
23
24
25
26
# File 'lib/yard-api/markup/redcarpet.rb', line 22

def initialize(text, extensions_and_options=nil)
  @renderer = Redcarpet::Render::HTML.new(RendererOptions)
  @markdown = Redcarpet::Markdown.new(@renderer, Extensions)
  @text = text
end

Instance Method Details

#to_htmlObject



28
29
30
# File 'lib/yard-api/markup/redcarpet.rb', line 28

def to_html
  @markdown.render(@text)
end