Current section

Files

Jump to
html_to_markdown lib html_to_markdown text_annotation.ex
Raw

lib/html_to_markdown/text_annotation.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:587d200c95438abc2158e73f50ad7a072bde7ec6ef55df8510c6b9bc5343923c
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule HtmlToMarkdown.TextAnnotation do
@moduledoc """
A styling or semantic annotation that applies to a byte range within a node's text.
Unlike [`DocumentNode`], which captures block-level structure (headings, paragraphs, etc.),
a `TextAnnotation` describes inline-level markup — bold, italic, links, code spans, and
similar — that spans a contiguous run of bytes inside `DocumentNode::content`'s text field.
Byte offsets (`start`..`end`) are into the UTF-8 encoded text of the parent node. The range
follows Rust slice conventions: `start` is inclusive and `end` is exclusive, so the annotated
text is `text[start as usize..end as usize]`.
Multiple annotations on the same node can overlap (e.g. bold-italic text), and they are
stored in the order they are encountered during DOM traversal.
See [`AnnotationKind`] for the full list of supported annotation types.
"""
@typedoc "A styling or semantic annotation that applies to a byte range within a node's text."
@type t :: %__MODULE__{
start: non_neg_integer(),
end: non_neg_integer(),
kind: String.t() | nil
}
defstruct start: 0,
end: 0,
kind: :bold
end