Skip to content

Version 0.15.0

Compare
Choose a tag to compare
@chasefleming chasefleming released this 21 Nov 17:19
· 143 commits to main since this release
c3c0432

🚀 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.