Skip to content

Raw HTML

Plain { expr } values are HTML-escaped. Use gsx.Raw only when a trusted or sanitized string must render as markup.

Rendering trusted HTML

gsx
package views

import "github.com/gsxhq/gsx"

// ArticleBody renders pre-sanitized HTML from a CMS or Markdown converter.
// { gsx.Raw(html) } emits the string verbatim — no entity encoding.
component ArticleBody(html string) {
	<article>{ gsx.Raw(html) }</article>
}

Renders:

html
<article><em>Hello</em> &amp; <strong>World</strong></article>

▶ Open in Playground

Security

gsx.Raw writes the supplied HTML without escaping. The value must already be trusted or sanitized; never pass it unvalidated user input. See Escaping for the other explicit trust boundaries.