diff --git a/htmgo-site/md/docs/2_core-concepts/6_raw_html.md b/htmgo-site/md/docs/2_core-concepts/6_raw_html.md new file mode 100644 index 0000000..666b275 --- /dev/null +++ b/htmgo-site/md/docs/2_core-concepts/6_raw_html.md @@ -0,0 +1,22 @@ +**Rendering 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: +```go +h.UnsafeRaw(string) +h.UnsafeRawF(string, ...interface{}) +h.UnsafeRawScript(string) +``` + +Usage: +```go + +h.UnsafeRaw("
Raw HTML
") +h.UnsafeRawF("
%s
", "Raw HTML") +h.UnsafeRawScript("") +``` + +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 the `html.EscapeString` function or by using https://github.com/microcosm-cc/bluemonday. \ No newline at end of file