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



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

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



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

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


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

def link(_node)
  out(:children)
end