Class: CommonMarker::CompatRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/commonmarker/compat_renderer.rb

Overview

Compatibility with the RedCloth API.

Constant Summary collapse

DEFAULT_EXTENSIONS =
%i[tagfilter autolink table strikethrough].freeze
DEFAULT_OPTIONS =
%i[GITHUB_PRE_LANG].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, *exts, options: DEFAULT_OPTIONS) ⇒ CompatRenderer

Returns a new instance of CompatRenderer.


14
15
16
17
18
# File 'lib/commonmarker/compat_renderer.rb', line 14

def initialize(text, *exts, options: DEFAULT_OPTIONS)
  @text = text
  @extensions = DEFAULT_EXTENSIONS + exts
  @options = options || DEFAULT_OPTIONS
end

Instance Attribute Details

#extensions<Symbol> (readonly)

Returns:

  • (<Symbol>)


27
28
29
# File 'lib/commonmarker/compat_renderer.rb', line 27

def extensions
  @extensions
end

#optionsSymbol (readonly)

Returns:

  • (Symbol)


24
25
26
# File 'lib/commonmarker/compat_renderer.rb', line 24

def options
  @options
end

#textString

Returns:

  • (String)


21
22
23
# File 'lib/commonmarker/compat_renderer.rb', line 21

def text
  @text
end

Instance Method Details

#to_html(*_dummy) ⇒ Object



29
30
31
# File 'lib/commonmarker/compat_renderer.rb', line 29

def to_html(*_dummy)
  CommonMarker.render_html(text, options, extensions)
end