Class: FujiMarkdown::Renderers::NarouRenderer

Inherits:
TextRenderer
  • Object
show all
Defined in:
lib/fuji_markdown/renderers/narou_renderer.rb

Instance Method Summary collapse

Methods inherited from TextRenderer

#blockquote, #code, #header, #hrule, #paragraph, #softbreak

Instance Method Details

#code_block(node) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/fuji_markdown/renderers/narou_renderer.rb', line 4

def code_block(node)
  out("\n") if node.previous&.type&.==(:paragraph)
  block do
    out(escape_html(node.string_content))
  end
  out("\n")
end

#emph(node) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/fuji_markdown/renderers/narou_renderer.rb', line 12

def emph(node)
  node.walk do |n|
    if n.type == :text
      n.string_content = n.string_content.chars.map { |char| "|#{char}《・》"}.join
    end
  end
  out(:children)
end


21
22
23
# File 'lib/fuji_markdown/renderers/narou_renderer.rb', line 21

def link(node)
  out(:children)
end