Documentation
¶
Overview ¶
Package bdi provides constructors and methods for the HTML <bdi> element.
The <bdi> HTML element isolates text from its surrounding bidirectional text context, preventing it from affecting the directionality of adjacent text. Essential when embedding dynamic content of unknown directionality (like usernames or user-generated content) within text that might be right-to-left (RTL) or left-to-right (LTR). Prevents layout issues in multilingual applications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<bdi") TagClose = []byte("</bdi>") )
Byte constants for HTML rendering.
Functions ¶
func New ¶
New creates a new bdi element with the given child nodes. Example: bdi.New(text.Text("username")) Renders: <bdi>username</bdi>
func RawText ¶
func RawText(str string) *element
RawText creates a new bdi element with raw text content as unescaped HTML. Example: bdi.RawText("<span>User</span>") Renders: <bdi><span>User</span></bdi>
func RawTextf ¶
RawTextf creates a new bdi element with formatted raw text content as unescaped HTML using text.RawTextf. Example: bdi.RawTextf("<strong>%s</strong>", "User") Renders: <bdi><strong>User</strong></bdi>
func Static ¶
func Static(str string) *element
Static creates a new bdi element with static text content. Example: bdi.Static("User123") Renders: <bdi>User123</bdi>