Current section

Files

Jump to
html_to_markdown lib html_to_markdown conversion_options.ex
Raw

lib/html_to_markdown/conversion_options.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:7471d00a591a836cdb7076cfa76ddf0a8b03850c500d98669bcb0c59b507180a
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule HtmlToMarkdown.ConversionOptions do
@moduledoc """
Main conversion options for HTML to Markdown conversion.
Use [`ConversionOptions::builder()`] to construct, or [`Default::default()`] for defaults.
# Example
```rust
use html_to_markdown_rs::{ConversionOptions, HeadingStyle};
let options = ConversionOptions::builder()
.heading_style(HeadingStyle::Atx)
.wrap(true)
.wrap_width(100)
.build();
```
"""
@typedoc "Main conversion options for HTML to Markdown conversion."
@type t :: %__MODULE__{
heading_style: String.t() | nil,
list_indent_type: String.t() | nil,
list_indent_width: non_neg_integer(),
bullets: String.t() | nil,
strong_em_symbol: String.t() | nil,
escape_asterisks: boolean(),
escape_underscores: boolean(),
escape_misc: boolean(),
escape_ascii: boolean(),
code_language: String.t() | nil,
autolinks: boolean(),
default_title: boolean(),
br_in_tables: boolean(),
compact_tables: boolean(),
highlight_style: String.t() | nil,
extract_metadata: boolean(),
whitespace_mode: String.t() | nil,
strip_newlines: boolean(),
wrap: boolean(),
wrap_width: non_neg_integer(),
convert_as_inline: boolean(),
sub_symbol: String.t() | nil,
sup_symbol: String.t() | nil,
newline_style: String.t() | nil,
code_block_style: String.t() | nil,
keep_inline_images_in: [String.t()],
preprocessing: map(),
encoding: String.t() | nil,
debug: boolean(),
strip_tags: [String.t()],
preserve_tags: [String.t()],
skip_images: boolean(),
url_escape_style: String.t() | nil,
link_style: String.t() | nil,
output_format: String.t() | nil,
include_document_structure: boolean(),
extract_images: boolean(),
max_image_size: non_neg_integer(),
capture_svg: boolean(),
infer_dimensions: boolean(),
max_depth: non_neg_integer() | nil,
exclude_selectors: [String.t()],
tier_strategy: String.t() | nil,
visitor: reference() | nil
}
defstruct heading_style: :atx,
list_indent_type: :spaces,
list_indent_width: 2,
bullets: "-*+",
strong_em_symbol: "*",
escape_asterisks: false,
escape_underscores: false,
escape_misc: false,
escape_ascii: false,
code_language: "",
autolinks: true,
default_title: false,
br_in_tables: false,
compact_tables: false,
highlight_style: :double_equal,
extract_metadata: true,
whitespace_mode: :normalized,
strip_newlines: false,
wrap: false,
wrap_width: 80,
convert_as_inline: false,
sub_symbol: "",
sup_symbol: "",
newline_style: :spaces,
code_block_style: :backticks,
keep_inline_images_in: [],
preprocessing: nil,
encoding: "utf-8",
debug: false,
strip_tags: [],
preserve_tags: [],
skip_images: false,
url_escape_style: :angle,
link_style: :inline,
output_format: :markdown,
include_document_structure: false,
extract_images: false,
max_image_size: 5_242_880,
capture_svg: false,
infer_dimensions: true,
max_depth: nil,
exclude_selectors: [],
tier_strategy: :auto,
visitor: nil
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