Current section

Files

Jump to
html_to_markdown lib html_to_markdown conversion_result.ex
Raw

lib/html_to_markdown/conversion_result.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:61bf09f33eb2faa62974efc6fd1521f704c1d132337671f4bfa46aa22dd34031
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule HtmlToMarkdown.ConversionResult do
@moduledoc """
The primary result of HTML conversion and extraction.
Contains the converted text output, optional structured document tree,
metadata, extracted tables, images, and processing warnings.
# Example
```text
use html_to_markdown_rs::{convert, ConversionOptions};
let result = convert("<h1>Hello</h1><p>World</p>", None)?;
assert!(result.content.is_some());
assert!(result.warnings.is_empty());
```
"""
@typedoc "The primary result of HTML conversion and extraction."
@type t :: %__MODULE__{
content: String.t() | nil,
document: map() | nil,
metadata: map(),
tables: [map()],
warnings: [map()]
}
defstruct content: nil,
document: nil,
metadata: nil,
tables: [],
warnings: []
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end