erlmark (erlmark v0.1.1)
View SourceFast, pure Erlang Markdown to HTML converter.
Implements CommonMark 0.31.2 plus the GFM tables, strikethrough and task-list extensions. Extended autolinks and the tagfilter are opt-in.
1> erlmark:to_html(<<"# Hello *world*">>).
<<"<h1>Hello <em>world</em></h1>\n">>Raw HTML in the input is passed through unchanged, as CommonMark requires. Sanitise the output if the input is untrusted.
Summary
Functions
Equivalent to to_html(Markdown, []).
Convert Markdown to an HTML binary. See option() for the available options. Errors raised while converting in a helper process are re-raised in the caller.
Types
-type option() :: {spawn_above, non_neg_integer() | infinity} | {parallel, false | auto | pos_integer()} | {extensions, [autolink | tagfilter]}.
Conversion options:
{spawn_above, Bytes | infinity}- Inputs larger than
Bytesare converted in a short-lived helper process with a pre-sized heap, which avoids most garbage collection.infinityalways converts in the calling process. Default: 256. {parallel, false | auto | N}- Split large documents at top-level block boundaries and convert the pieces on
Nschedulers (autois all online ones). The output is identical to sequential conversion. Documents under 16 KB are never split. Default:false. {extensions, [autolink | tagfilter]}- Opt-in GFM extensions.
autolinkturns barewww.,http(s)://andftp://URLs and e-mail addresses into links.tagfilterescapes<script>,<style>and similar tags. Conversion with extensions is always sequential. Default: none.
Functions
Equivalent to to_html(Markdown, []).
Convert Markdown to an HTML binary, with default options.
Convert Markdown to an HTML binary. See option() for the available options. Errors raised while converting in a helper process are re-raised in the caller.
1> erlmark:to_html(<<"www.example.com">>, [{extensions, [autolink]}]).
<<"<p><a href=\"http://www.example.com\">www.example.com</a></p>\n">>