items

package
v0.24.10 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package items implements granular content splitting (AGENTS #100): an html/markdown body is decomposed BEFORE insertion into a typed tree of Items (paragraph / heading / table / row / cell / image / link / page). Every Item carries its canonical content URL (internal/address) and its full path of indexed segments so a DOM/jQuery-like selector can address any leaf (see internal/selector).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Scheme   string
	Platform string
	Thread   string
	Msg      string
}

Base carries the scheme/platform/thread/msg prefix used to build each Item's canonical URL (internal/address).

type Item

type Item struct {
	Kind     Kind
	Seg      address.Segment
	Path     []address.Segment
	URL      string
	Body     string
	Src      string // image src / link href target URL
	Alt      string
	Href     string
	Children []*Item
}

Item is one node in the split tree. Path is the full list of indexed segments from the root (leaf last, e.g. body/p[3]/table[0]); URL is the canonical content URL for this node.

func SplitHTML

func SplitHTML(raw string, base Base) ([]*Item, error)

SplitHTML parses an HTML body into a typed Item tree. Returns the top-level page item(s); for a normal document that is exactly one.

func SplitMarkdown

func SplitMarkdown(raw string, base Base) ([]*Item, error)

SplitMarkdown splits a markdown body into a typed Item tree (paragraphs, pipe-tables, standalone image/link blocks). Indices are per-type within the page.

type Kind

type Kind int

Kind is a named int type for the node type of an Item (AGENTS: enums are named int types, never loose strings at boundaries).

const (
	KindPage Kind = iota
	KindHeading
	KindParagraph
	KindTable
	KindRow
	KindCell
	KindImage
	KindLink
)

func (Kind) String

func (k Kind) String() string

Jump to

Keyboard shortcuts

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