imagemap

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 imagemap provides constructors and methods for the HTML <map> element.

The <map> HTML element is used with <area> elements to define an image map (a clickable link area).

Index

Constants

This section is empty.

Variables

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

	AttrName = []byte(" name=\"")
)

Byte constants for HTML rendering.

Functions

func Named added in v0.3.0

func Named(name string, nodes ...node.Node) *element

Named creates a named map element with child area elements. The name is required and must match the usemap attribute on the associated img element (prefixed with #). Example: imagemap.Named("nav", area.Rect(0, 0, 100, 50, "/page1")) Renders: <map name="nav"><area shape="rect" coords="0,0,100,50" href="/page1" /></map>

func New

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

New creates a new map element with optional child nodes (typically area elements). Example: imagemap.New(area.Rect(0, 0, 100, 50, "/page1")) Renders: <map><area shape="rect" coords="0,0,100,50" href="/page1" /></map>

func RawText

func RawText(str string) *element

RawText creates a new map element with raw text content. Uses text.RawText which is not HTML-escaped. Example: imagemap.RawText("<p>Navigation links</p>") Renders: <map><p>Navigation links</p></map>

func RawTextf

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

RawTextf creates a new map element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: imagemap.RawTextf("<p>%s navigation</p>", section) Renders: <map><p>main navigation</p></map>

func Static

func Static(str string) *element

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

func Text

func Text(str string) *element

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

func Textf

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

Textf creates a new map element with formatted text content. Uses text.Textf which HTML-escapes the output. Example: imagemap.Textf("%s map", region) Renders: <map>Europe map</map>

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