cmark v0.6.2 Cmark
Compiles Markdown formatted text into HTML
Provides:
Summary
Functions
Compiles one or more (list) Markdown documents to HTML and returns result
Compiles one or more (list) Markdown documents to HTML and calls function with result
Compiles one or more (list) Markdown documents to HTML using provided options and calls function with result
Compiles a list of Markdown documents using provided options 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) -> "HTML is #{html}" |> String.strip end
iex> "test" |> Cmark.to_html(callback)
"HTML is <p>test</p>"
iex> callback = fn (htmls) ->
iex> Enum.map(htmls, &String.strip/1) |> Enum.join("<hr>")
iex> end
iex> ["list", "test"] |> Cmark.to_html(callback)
"<p>list</p><hr><p>test</p>"
Compiles one or more (list) Markdown documents to HTML using provided options and calls function with result.
Examples
iex> callback = fn (htmls) ->
iex> Enum.map(htmls, &String.strip/1) |> Enum.join("<hr>")
iex> end
iex> ["en-dash --", "ellipsis..."] |> Cmark.to_html(callback, [:smart])
"<p>en-dash –</p><hr><p>ellipsis…</p>"
Compiles a list of Markdown documents using provided options and calls function for each item.
Examples
iex> callback = fn (html) -> "HTML is #{html |> String.strip}" end
iex> ["list", "test"] |> Cmark.to_html_each(callback)
["HTML is <p>list</p>", "HTML is <p>test</p>"]