Packages
earmark_parser
1.4.33
1.4.46
1.4.45
1.4.44
1.4.43
1.4.42
1.4.41
1.4.40
1.4.39
1.4.38
1.4.37
1.4.36
1.4.35
1.4.34
1.4.33
1.4.32
1.4.31
1.4.30
1.4.29
1.4.28
1.4.27
1.4.26
1.4.25
1.4.24
1.4.23
1.4.22
1.4.21
1.4.20
1.4.20-pre
1.4.19
1.4.18
1.4.17
1.4.16
1.4.16-pre2
1.4.16-pre1
1.4.16-pre
1.4.15
1.4.13
1.4.12
1.4.11
1.4.10
1.4.9
1.4.8
AST parser and generator for Markdown
Current section
Files
Jump to
Current section
Files
lib/earmark_parser/ast/renderer/html_renderer.ex
defmodule EarmarkParser.Ast.Renderer.HtmlRenderer do
import EarmarkParser.Context, only: [prepend: 2]
import EarmarkParser.Helpers.HtmlParser
import EarmarkParser.Helpers.AstHelpers, only: [annotate: 2]
@moduledoc false
# Structural Renderer for html blocks
def render_html_block(lines, context, annotation)
def render_html_block(lines, context, annotation) do
[tag] = parse_html(lines)
tag_ = if annotation, do: annotate(tag, annotation), else: tag
prepend(context, tag_)
end
def render_html_oneline([line|_], context, annotation \\ []) do
[tag|rest] = parse_html([line])
tag_ = if annotation, do: annotate(tag, annotation), else: tag
prepend(context, [tag_|rest])
end
@html_comment_start ~r{\A\s*<!--}
@html_comment_end ~r{-->.*\z}
def render_html_comment_line(line) do
line
|> String.replace(@html_comment_start, "")
|> String.replace(@html_comment_end, "")
end
end