HtmlToMarkdown.NodeContext (html_to_markdown v3.6.0-rc.13)

Copy Markdown

Context information passed to all visitor methods.

Provides comprehensive metadata about the current node being visited, including its type, tag name, position in the DOM tree, and parent context.

Attributes

Access attributes via [NodeContext::attributes], which returns &BTreeMap<String, String>. When the context was built with [NodeContext::with_lazy_attributes] (the hot path inside the converter), the map is only materialized on the first call — if the visitor never reads attributes, the allocation is skipped.

Lifetimes

String fields use [Cow<'_, str>] so the converter can pass slices directly out of the parsed DOM without allocating. Visitor implementations that need to outlive the callback should call [NodeContext::into_owned].

Summary

Types

t()

Context information passed to all visitor methods.

Types

t()

@type t() :: %HtmlToMarkdown.NodeContext{
  depth: non_neg_integer(),
  index_in_parent: non_neg_integer(),
  is_inline: boolean(),
  node_type: String.t() | nil,
  parent_tag: String.t() | nil,
  tag_name: String.t() | nil
}

Context information passed to all visitor methods.