Documentation
¶
Overview ¶
Package html implements a component wrapper for Paper's HTML translator.
Index ¶
- Variables
- func NewAutoRow(ctx context.Context, htmlStr string, opts ...Option) (core.Row, error)
- func NewCol(ctx context.Context, size int, htmlStr string, opts ...Option) (core.Col, error)
- func NewRow(ctx context.Context, height float64, htmlStr string, opts ...Option) (core.Row, error)
- type HTML
- type Limits
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( // WithUnsupportedHandler registers a callback invoked for unsupported HTML // tags or CSS properties. WithUnsupportedHandler = paperhtml.WithUnsupportedHandler // WithGridSize overrides the default grid size used for flex quantization. WithGridSize = paperhtml.WithGridSize // WithContentWidth sets the content width in mm for width-aware CSS features. WithContentWidth = paperhtml.WithContentWidth // WithImageBaseDir scopes local image reads to a single directory. WithImageBaseDir = paperhtml.WithImageBaseDir // WithStylesheetBaseDir scopes local stylesheet reads to a single directory. WithStylesheetBaseDir = paperhtml.WithStylesheetBaseDir // WithLimits configures resource limits for untrusted HTML. WithLimits = paperhtml.WithLimits // WithUnsafeNoLimits disables resource limits for trusted HTML. WithUnsafeNoLimits = paperhtml.WithUnsafeNoLimits )
Re-exported translation options. These alias pkg/html so the component facade stays in sync with the underlying translator's signatures.
Functions ¶
func NewAutoRow ¶
NewAutoRow wraps an HTML component in an auto-height row.
Types ¶
type HTML ¶
type HTML struct {
// contains filtered or unexported fields
}
HTML is a core.Component backed by rows produced from an HTML fragment.
func New ¶
New converts an HTML string into a component that can be placed inside a column like any other Paper component. It observes ctx during translation.
func (*HTML) GetHeight ¶
GetHeight returns the sum of the translated row heights inside the target cell width.
func (*HTML) GetStructure ¶
GetStructure returns the component tree node for snapshots/debugging.
func (*HTML) Render ¶
Render draws each translated row sequentially inside the component cell. The pen is reset to the row origin before each child Render so cellwriter chain nodes that rely on GetXY draw at the right position, then reset to the cell origin afterwards — matching blockContainer.Render's contract.