Class: Qiita::Markdown::Filters::Greenmat

Inherits:
HTML::Pipeline::TextFilter
  • Object
show all
Defined in:
lib/qiita/markdown/filters/greenmat.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rendererGreenmat::Markdown

Memoize.

Returns:

  • (Greenmat::Markdown)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/qiita/markdown/filters/greenmat.rb', line 10

def renderer
  @renderer ||= ::Greenmat::Markdown.new(
    ::Greenmat::Render::HTML.new(
      hard_wrap: true,
    ),
    autolink: true,
    fenced_code_blocks: true,
    footnotes: true,
    no_intra_emphasis: true,
    no_mention_emphasis: true,
    strikethrough: true,
    tables: true,
  )
end

Instance Method Details

#callNokogiri::HTML::DocumentFragment

Returns:

  • (Nokogiri::HTML::DocumentFragment)


27
28
29
# File 'lib/qiita/markdown/filters/greenmat.rb', line 27

def call
  Nokogiri::HTML.fragment(self.class.renderer.render(@text))
end