Getting Started
Core Concepts
Control
Interactivity
Performance
Pushing Data
HTMX Extensions
Miscellaneous
Configuration
Raw HTML
In some cases, you may want to render raw html instead of using htmgo's functions.
This can be done by using the following methods:
Rendering raw html:
h.UnsafeRaw("
Raw HTML
")h.UnsafeRaw("<div>Raw HTML</div>")
Copy
Rendering with formatting:
h.UnsafeRawF("
%s
", "Raw HTML")h.UnsafeRawF("<div>%s</div>", "Raw HTML")
Copy
Rendering a script:
h.UnsafeRawScript("alert('Hello World')")
h.UnsafeRawScript("alert('Hello World')")
Copy
Important: Be careful when using these methods, these methods do not escape the HTML content
and should never be used with user input unless you have sanitized the input.
Sanitizing input can be done using html.EscapeString or by using bluemonday for more control over sanitization.