Class: FujiMarkdown::Renderers::TextRenderer
- Inherits:
-
CommonMarker::HtmlRenderer
- Object
- CommonMarker::HtmlRenderer
- FujiMarkdown::Renderers::TextRenderer
show all
- Defined in:
- lib/fuji_markdown/renderers/text_renderer.rb
Instance Method Summary
collapse
Instance Method Details
#blockquote(node) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 22
def blockquote(node)
out("\n") if node.previous&.type&.==(:paragraph)
block do
out('> ', :children)
end
out("\n")
end
|
#code(node) ⇒ Object
52
53
54
55
56
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 52
def code(node)
out('`')
out(escape_html(node.string_content))
out('`')
end
|
#code_block(node) ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 34
def code_block(node)
out("\n") if node.previous&.type&.==(:paragraph)
out('```')
block do
out(escape_html(node.string_content))
end
out('```')
out("\n")
end
|
#emph(_) ⇒ Object
44
45
46
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 44
def emph(_)
out('*', :children, '*')
end
|
6
7
8
9
10
11
12
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 6
def (node)
out("\n") if node.previous&.type&.==(:paragraph)
block do
out('#' * node., ' ', :children)
end
out("\n")
end
|
#hrule(_) ⇒ Object
30
31
32
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 30
def hrule(_)
out("\n")
end
|
#link(node) ⇒ Object
48
49
50
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 48
def link(node)
out('[', :children, '](', node.url.nil? ? '' : escape_href(node.url), ')')
end
|
#paragraph(node) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 14
def paragraph(node)
return out(:children) if node.parent.type == :blockquote
block do
out(:children)
end
end
|
#softbreak(_) ⇒ Object
58
59
60
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 58
def softbreak(_)
out("\n")
end
|