Documentation
¶
Overview ¶
Package bdo provides constructors and methods for the HTML <bdo> element.
The <bdo> HTML element forcibly overrides the bidirectional text algorithm, rendering text in a specific direction regardless of its natural directionality. Used when you need to explicitly control text direction for special formatting, displaying code examples, or showing text in an intentionally reversed manner. Requires the dir attribute to specify the override direction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<bdo") TagClose = []byte("</bdo>") AttrDir = []byte(" dir=\"") )
Byte constants for HTML rendering.
Functions ¶
func New ¶
New creates a new bdo element with child nodes. Example: bdo.New(text.Text("Hello")) Renders: <bdo>Hello</bdo>
func RawText ¶
func RawText(str string) *element
RawText creates a new bdo element with raw text content as unescaped HTML. Example: bdo.RawText("<em>Text</em>").Dir(dir.RightToLeft) Renders: <bdo dir="rtl"><em>Text</em></bdo>
func RawTextf ¶
RawTextf creates a new bdo element with formatted raw text content as unescaped HTML using text.RawTextf. Example: bdo.RawTextf("<strong>%s</strong>", "Text").Dir(dir.RightToLeft) Renders: <bdo dir="rtl"><strong>Text</strong></bdo>
func Static ¶
func Static(str string) *element
Static creates a new bdo element with static text content. Example: bdo.Static("ABC").Dir(dir.LeftToRight) Renders: <bdo dir="ltr">ABC</bdo>