From 073151cf14215fa191580348838b4ee9ce4ad3de Mon Sep 17 00:00:00 2001 From: maddalax Date: Sat, 28 Sep 2024 20:52:11 -0500 Subject: [PATCH] add docs about raw html --- .../md/docs/2_core-concepts/6_raw_html.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 htmgo-site/md/docs/2_core-concepts/6_raw_html.md 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