Documentation
¶
Overview ¶
Package p provides constructors and methods for the HTML <p> element.
The <p>: The Paragraph element represents a paragraph. Paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but HTML paragraphs can be any structural grouping of related content, such as images or form fields.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( TagOpen = []byte("<p") TagClose = []byte("</p>") )
Byte constants for HTML rendering.
Functions ¶
func New ¶
New creates a new paragraph element with optional child nodes Example: p.New(text.Text("Hello")) Renders: <p>Hello</p>
func RawText ¶
func RawText(content string) *element
RawText creates a new p element with raw text content. Uses text.RawText which is not HTML-escaped. Example: p.RawText("Text with <em>emphasis</em>") Renders: <p>Text with <em>emphasis</em></p>
func RawTextf ¶
RawTextf creates a new p element with formatted raw text content. Uses text.RawTextf which is not HTML-escaped. Example: p.RawTextf("Hello, <strong>%s</strong>!", name) Renders: <p>Hello, <strong>Mary</strong>!</p>
func Static ¶
func Static(content string) *element
Static creates a new p element with static text content. Uses text.Static which is not HTML-escaped and is JIT-optimisable. Example: p.Static("Welcome to the site.") Renders: <p>Welcome to the site.</p>