html

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

HTML node

Type: html
Category: Parsers

Extracts elements/text/attributes from HTML via a CSS selector.

Behavior

This node is registered as html and runs as part of a workflow. Its exact runtime behavior is implemented in node.go; this document summarizes the editor-facing purpose and configuration contract.

Configuration

Field Type Default Description
as string single Output — single: one message with an array payload; multi: one parts-tagged message per match
outproperty string payload Output Property — Message property the extraction is written to (defaults to property)
property string payload Property — Message property holding the HTML
ret string html Return — html: element outer HTML; text: element text; val: the value attribute; any other value names an attribute (Node-RED semantics)
tag string Selector — CSS selector. Supported subset: tag, .class, #id, [attr], [attr=value], descendant and > combinators, comma groups

Implementation

  • node.go contains the executor, validation, schema, and registration.
  • editor.html contains the editor integration.
  • node_test.go, when present, contains behavioral tests.

Documentation

Overview

Package html contains the html node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTMLConfig

type HTMLConfig struct {
	// Tag is the CSS selector. Supported subset: tag, .class, #id,
	// [attr], [attr=value], descendant and child (>) combinators,
	// comma-separated groups.
	Tag string `json:"tag"`
	// Ret selects what each match produces: "html" (outer HTML,
	// default), "text" (element text), "val" (the value attribute),
	// or any other string naming an attribute (Node-RED semantics).
	Ret string `json:"ret"`
	// As selects the output shape: "single" (one message whose payload
	// is an array of matches — Node-RED default) or "multi" (one
	// parts-tagged message per match).
	As string `json:"as"`
	// Property is the message property holding the HTML
	// (default "payload").
	Property string `json:"property"`
	// OutProperty is the message property the extraction is written to
	// (defaults to Property).
	OutProperty string `json:"outproperty"`
}

HTMLConfig holds configuration for the html node — the Node-RED `html` equivalent: it extracts elements from an HTML message payload via a CSS selector.

type HTMLNode

type HTMLNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

HTMLNode extracts elements/text/attributes from an HTML payload. "single" mode stashes matches for the MessageExpander hook so each match travels downstream as its own parts-tagged message.

func NewHTMLNode

func NewHTMLNode(node nodestore.NodeInterface, config *HTMLConfig) *HTMLNode

NewHTMLNode creates a new html node

func (*HTMLNode) Execute

Execute parses the payload HTML and evaluates the selector. "single" (the default) writes an array of matches to the output property; "multi" stashes matches and returns a shell expanded by Expand into one parts-tagged message per match.

func (*HTMLNode) Expand

Expand turns stashed matches into one parts-tagged message per match (same parts {id,type,index,count} shape the split node produces so a downstream join can reassemble).

func (*HTMLNode) Validate

func (n *HTMLNode) Validate() error

Validate checks the html node configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL