Documentation
¶
Overview ¶
Package htmllist implements HTML-style bullet and numbered list components.
Index ¶
- func FormatMarker(style StyleType, idx int) string
- type HTMLList
- func (l *HTMLList) GetHeight(provider core.Provider, cell *entity.Cell) float64
- func (l *HTMLList) GetStructure() *node.Node[core.Structure]
- func (l *HTMLList) MarkerLabel(i int) (string, bool)
- func (l *HTMLList) Render(provider core.Provider, cell *entity.Cell)
- func (l *HTMLList) SetConfig(config *entity.Config)
- type Item
- type ItemMarker
- type Prop
- type StyleType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatMarker ¶
FormatMarker returns the formatted marker string for a given style and 0-based index.
Types ¶
type HTMLList ¶
type HTMLList struct {
// contains filtered or unexported fields
}
HTMLList is a core.Component rendering bullet/numbered lists.
func (*HTMLList) GetStructure ¶
GetStructure returns the component node for snapshots/debugging.
func (*HTMLList) MarkerLabel ¶ added in v0.2.2
MarkerLabel returns the formatted marker text for a zero-based item index, honoring Start/StartSet/Reversed. ok is false for out-of-range indexes.
func (*HTMLList) Render ¶
Render draws all list items into the PDF cell. Each item's row height is the actual wrapped height of its content (not a fixed single-line itemH) — this prevents markers from stacking when items have long text that wraps to multiple lines. The marker (text or circle) is always positioned at the top of its item's row, anchored to the first line of content.
type Item ¶
type Item struct {
Content core.Component
SubList *HTMLList
// Marker optionally overrides how this item's marker renders (from CSS
// ::marker rules). nil keeps the list-level default.
Marker *ItemMarker
}
Item is a single list entry.
type ItemMarker ¶ added in v0.2.2
type ItemMarker struct {
// Text replaces the style-derived label (e.g. ::marker content). A custom
// text renders even when the list style is None.
Text string
// Suppress removes the marker entirely (::marker content: none).
Suppress bool
// TextProp carries per-item text overrides; zero fields keep defaults.
TextProp *props.Text
}
ItemMarker overrides a single item's marker rendering.
type Prop ¶
type Prop struct {
Style StyleType
Start int // first marker value; 0 = default unless StartSet
// StartSet distinguishes an explicit start="0" (or negative start) from
// the attribute being absent.
StartSet bool
Reversed bool // ordered markers count down from Start or item count
Indent float64 // mm per nesting level
MarkerPadding float64 // mm gap between marker and content
GutterWidth float64 // 0 = measure at render time
// MarkerBackground is the fill color used for circle markers (DecimalCircle).
// Default: dark navy (#1a3e72) when nil.
MarkerBackground *props.Color
// MarkerTextColor is the text color used for the number inside circle markers.
// Default: white when nil.
MarkerTextColor *props.Color
}
Prop holds list-level configuration.
type StyleType ¶
type StyleType string
StyleType controls the marker style.
const ( None StyleType = "none" Bullet StyleType = "bullet" Decimal StyleType = "decimal" DecimalCircle StyleType = "decimal-circle" LowerAlpha StyleType = "lower-alpha" UpperAlpha StyleType = "upper-alpha" LowerRoman StyleType = "lower-roman" UpperRoman StyleType = "upper-roman" )
The marker styles a list can use: no marker, a bullet, or one of the numbered and lettered sequences.