HtmlToMarkdown (html_to_markdown v2.22.5)
View SourceHigh-level Elixir interface for the Rust html-to-markdown engine.
Summary
Functions
Convert HTML to Markdown.
Convert HTML to Markdown and raise on failure.
Convert HTML and collect inline image assets.
Bang variant of convert_with_inline_images/3.
Convert HTML to Markdown and extract metadata.
Bang variant of convert_with_metadata/3.
Convert HTML using a reusable options handle.
Variant of convert_with_options/2 that raises on failure.
Create a reusable options handle (opaque reference).
Start Rust-side profiling and write a flamegraph to the given output path.
Stop Rust-side profiling and flush the flamegraph.
Types
@type inline_config_input() :: HtmlToMarkdown.InlineImageConfig.t() | map() | keyword() | nil
@type metadata_config_input() :: HtmlToMarkdown.MetadataConfig.t() | map() | keyword() | nil
@type options_input() :: HtmlToMarkdown.Options.t() | map() | keyword() | nil
Functions
@spec convert(String.t(), options_input()) :: {:ok, String.t()} | {:error, term()}
Convert HTML to Markdown.
The options argument accepts an %HtmlToMarkdown.Options{} struct,
a map/keyword list with option keys, or nil (defaults).
@spec convert!(String.t(), options_input()) :: String.t()
Convert HTML to Markdown and raise on failure.
@spec convert_with_inline_images(String.t(), options_input(), inline_config_input()) :: {:ok, String.t(), [HtmlToMarkdown.InlineImage.t()], [HtmlToMarkdown.InlineImageWarning.t()]} | {:error, term()}
Convert HTML and collect inline image assets.
Returns {:ok, markdown, inline_images, warnings}.
@spec convert_with_inline_images!(String.t(), options_input(), inline_config_input()) :: {String.t(), [HtmlToMarkdown.InlineImage.t()], [HtmlToMarkdown.InlineImageWarning.t()]}
Bang variant of convert_with_inline_images/3.
@spec convert_with_metadata(String.t(), options_input(), metadata_config_input()) :: {:ok, String.t(), map()} | {:error, term()}
Convert HTML to Markdown and extract metadata.
Returns {:ok, markdown, metadata}.
@spec convert_with_metadata!(String.t(), options_input(), metadata_config_input()) :: {String.t(), map()}
Bang variant of convert_with_metadata/3.
Convert HTML using a reusable options handle.
Variant of convert_with_options/2 that raises on failure.
@spec options(options_input()) :: reference()
Create a reusable options handle (opaque reference).
The handle can be passed to convert_with_options/2.
Start Rust-side profiling and write a flamegraph to the given output path.
@spec stop_profiling() :: :ok | {:error, term()}
Stop Rust-side profiling and flush the flamegraph.