hgroup

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package hgroup provides constructors and methods for the HTML <hgroup> element.

The <hgroup> HTML element represents a heading and related content. It groups a single <h1>–<h6> element with one or more <p>.

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<hgroup")
	TagClose = []byte("</hgroup>")
)

Byte constants for HTML rendering.

Functions

func New

func New(nodes ...node.Node) *element

New creates a new hgroup element with child nodes (typically a heading and subtitle paragraphs). Example: hgroup.New(h1.Text("Main Title"), p.Text("A subtitle")) Renders: <hgroup><h1>Main Title</h1><p>A subtitle</p></hgroup>

func RawText

func RawText(str string) *element

RawText creates a new hgroup element with raw text content. Uses text.RawText which is not HTML-escaped. Example: hgroup.RawText("<h2>Title</h2><p>Subtitle</p>") Renders: <hgroup><h2>Title</h2><p>Subtitle</p></hgroup>

func RawTextf

func RawTextf(format string, args ...any) *element

RawTextf creates a new hgroup element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: hgroup.RawTextf("<h2>%s</h2><p>%s</p>", title, subtitle) Renders: <hgroup><h2>Dashboard</h2><p>A deeper look</p></hgroup>

func Static

func Static(str string) *element

Static creates a new hgroup element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: hgroup.Static("Heading group") Renders: <hgroup>Heading group</hgroup>

func Text

func Text(str string) *element

Text creates a new hgroup element with text content. Uses text.Text which HTML-escapes the output. Example: hgroup.Text("Heading group") Renders: <hgroup>Heading group</hgroup>

func Textf

func Textf(format string, args ...any) *element

Textf creates a new hgroup element with formatted text content. Uses text.Textf which HTML-escapes the output. Example: hgroup.Textf("Section %d", num) Renders: <hgroup>Section 1</hgroup>

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

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