Current section
Files
Jump to
Current section
Files
lib/crawlberg/content_config.ex
# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:75130b11765cbed0a1ea2b5bcffe59620c4045cee1c7cece391c5e3fa47b10e0
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule Crawlberg.ContentConfig do
@moduledoc """
Content extraction and conversion configuration.
Controls how HTML is converted to the output format. Uses
html-to-markdown-rs as the conversion engine for all formats
(markdown, plain text, djot).
"""
@typedoc "Content extraction and conversion configuration."
@type t :: %__MODULE__{
output_format: String.t() | nil,
preprocessing_preset: String.t() | nil,
remove_navigation: boolean(),
remove_forms: boolean(),
strip_tags: [String.t()],
preserve_tags: [String.t()],
exclude_selectors: [String.t()],
skip_images: boolean(),
max_depth: non_neg_integer() | nil,
wrap: boolean(),
wrap_width: non_neg_integer(),
include_document_structure: boolean()
}
defstruct output_format: "markdown",
preprocessing_preset: "standard",
remove_navigation: true,
remove_forms: true,
strip_tags: [],
preserve_tags: [],
exclude_selectors: [],
skip_images: false,
max_depth: nil,
wrap: false,
wrap_width: 80,
include_document_structure: true
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