markupz (markupz v1.0.0)
View SourceConvert HTML fragments to Markdown or readable email text.
Summary
Functions
Safely convert HTML using the default preset.
Safely convert HTML using a preset or option map.
Convert an HTML email body to a readable text alternative.
Convert HTML using the default preset.
Convert HTML using a preset or an option map.
Types
-type html_option() :: keep | strip.
-type link_option() :: markdown | inline.
-type mode() :: default | faithful | email.
-type options() :: #{mode => mode(), html => html_option(), tables => table_option(), links => link_option()}.
-type table_option() :: markdown | text.
Functions
Safely convert HTML using the default preset.
-spec convert(iodata(), option_input()) -> {ok, binary()} | {error, reason()}.
Safely convert HTML using a preset or option map.
Convert an HTML email body to a readable text alternative.
Convert HTML using the default preset.
Raises error({invalid_html, Reason}) if the input or options are invalid.
-spec to_markdown(iodata(), option_input()) -> binary().
Convert HTML using a preset or an option map.
The default preset converts body content, omits ARIA-hidden elements, and flattens presentation tables. The faithful preset also includes document metadata and presentation HTML. The email preset strips unsupported HTML, removes hidden email content, and writes link destinations inline.