Earmark v1.4.4 Earmark.Transform View Source
Public Interface to functions operating on the AST
exposed by Earmark.as_ast
Link to this section Summary
Functions
EXPERIMENTAL But well tested, just expect API changes in the 1.4 branch Takes an ast, and optional options (I love this pun), which can be a map or keyword list of which the following keys will be used
Link to this section Functions
EXPERIMENTAL But well tested, just expect API changes in the 1.4 branch Takes an ast, and optional options (I love this pun), which can be a map or keyword list of which the following keys will be used:
smartypants:
boolean
initial_indent:
number
indent:
number
iex(1)> transform({"p", [], [{"em", [], "help"}, "me"]}) "<p>\n <em>\n help\n </em>\n me\n</p>\n"
Right now only transformation to HTML is supported.
The transform is also agnostic to any annotation map that is added to the AST.
Only the :meta
key is reserved and by passing annotation maps with a :meta
key
into the AST the result might become altered or an exception might be raised, otherwise...
iex(2)> transform({"p", [], [{"em", [], ["help"], %{inner: true}}], %{level: 1}})
"<p>\n <em>\n help\n </em>\n</p>\n"