Cmark
SourceSummary
to_html(data) | Compiles one or more (list) Markdown documents to HTML and returns result |
to_html(data, callback) | Compiles one or more (list) Markdown documents to HTML and calls function with result |
to_html_each(data, callback) | Compiles a list of Markdown documents and calls function for each item |
Functions
Compiles one or more (list) Markdown documents to HTML and returns result
Examples
iex> "test" |> Cmark.to_html
"<p>test</p>\n"
iex> ["# also works", "* with list", "`of documents`"] |> Cmark.to_html
["<h1>also works</h1>\n",
"<ul>\n<li>with list</li>\n</ul>\n",
"<p><code>of documents</code></p>\n"]
Compiles one or more (list) Markdown documents to HTML and calls function with result
Examples
iex> callback = fn (html) -> IO.write("HTML: #{html}") end
iex> "test" |> Cmark.to_html(callback)
HTML: <p>test</p>
:ok
iex> callback = fn (htmls) -> IO.write("HTML: #{inspect htmls}\n") end
iex> ["list", "test"] |> Cmark.to_html(callback)
HTML: ["<p>list</p>\n", "<p>test</p>\n"]
:ok