Version 0.15.0
🚀 New Features
Raw
HTML Insertion
The Raw
function has been added to allow direct insertion of raw HTML content into the document structure. This function is particularly useful for rendering HTML strings as part of the final output, without any modification or parsing. It offers a convenient way to integrate HTML content generated outside the elem-go
environment.
Example Usage
rawHTML := `<div class="custom-html"><p>Custom HTML content</p></div>`
content := elem.Div(nil,
elem.H1(nil, elem.Text("Hello, World!")),
elem.Raw(rawHTML), // Inserting the raw HTML
elem.P(nil, elem.Text("More content here...")),
)
htmlOutput := content.Render()
NOTE: Users should ensure to sanitize any HTML content from untrusted sources before using the
Raw
function to prevent security risks like XSS (Cross-Site Scripting) attacks.