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
20
21
22
23
24
25
26
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 20
def blockquote(node)
out("\n") if node.previous&.type&.==(:paragraph)
block do
out('> ', :children)
end
out("\n")
end
|
#code(node) ⇒ Object
50
51
52
53
54
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 50
def code(node)
out('`')
out(escape_html(node.string_content))
out('`')
end
|
#code_block(node) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 32
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
42
43
44
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 42
def emph(_)
out('*', :children, '*')
end
|
4
5
6
7
8
9
10
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 4
def (node)
out("\n") if node.previous&.type&.==(:paragraph)
block do
out('#' * node., ' ', :children)
end
out("\n")
end
|
#hrule(_) ⇒ Object
28
29
30
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 28
def hrule(_)
out("\n")
end
|
#link(node) ⇒ Object
46
47
48
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 46
def link(node)
out('[', :children, '](', node.url.nil? ? '' : escape_href(node.url), ')')
end
|
#paragraph(node) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 12
def paragraph(node)
return out(:children) if node.parent.type == :blockquote
block do
out(:children)
end
end
|
#softbreak(_) ⇒ Object
56
57
58
|
# File 'lib/fuji_markdown/renderers/text_renderer.rb', line 56
def softbreak(_)
out("\n")
end
|