utils

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheControl

func CacheControl(policy string, next http.Handler) http.Handler

CacheControl returns middleware that sets the Cache-Control header to the given policy.

func StaticByteHandler

func StaticByteHandler(b []byte, contentType string) http.Handler

StaticByteHandler returns a handler that serves static bytes with ETag-based cache validation.

func StaticPageHandler

func StaticPageHandler(ctx context.Context, c templ.Component) http.Handler

StaticPageHandler renders a templ component once at init and returns a handler that serves the resulting HTML.

Types

type ClickableHeadingRenderer

type ClickableHeadingRenderer struct {
	// contains filtered or unexported fields
}

Wraps all headings in a anchor tag, so that they are clickable for navigation purposes.

Only headings that already have an ID attribute will be wrapped. parser.WithAutoHeadingID can be used to automatically add the ID attributes.

If multiple headings have the same ID, to avoid collision each subsequent ID will be suffixed with a sequence number.

func NewClickableHeadingRenderer

func NewClickableHeadingRenderer() *ClickableHeadingRenderer

func (*ClickableHeadingRenderer) RegisterFuncs

Jump to

Keyboard shortcuts

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