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 ¶
- Variables
- func Named(name string, nodes ...node.Node) *element
- func New(nodes ...node.Node) *element
- func RawText(str string) *element
- func RawTextf(format string, args ...any) *element
- func Static(str string) *element
- func Text(str string) *element
- func Textf(format string, args ...any) *element
- type Element
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<map") TagClose = []byte("</map>") AttrName = []byte(" name=\"") )
Byte constants for HTML rendering.
Functions ¶
func Named ¶ added in v0.3.0
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 ¶
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 ¶
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>