From 4ee51fcd4c99641419a1fddb7528b7b1e1ba7868 Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 21 Nov 2023 08:36:18 -0800 Subject: [PATCH] Add `Raw` to README --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ecc0d2..e5d107d 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,23 @@ In this example, if `isAdmin` is `true`, the `Admin Panel` link is rendered. Oth - **Script-supporting Elements**: `Script`, `Noscript` - **Inline Semantic**: `A`, `Strong`, `Em`, `Code`, `I` -### Additional Utility: HTML Comments +### Raw HTML Insertion + +The `Raw` function allows for the direct inclusion of raw HTML content within your document structure. This function can be used to insert HTML strings, which will be rendered as part of the final HTML output. + +```go +rawHTML := `

Custom HTML content

` +content := elem.Div(nil, + elem.H1(nil, elem.Text("Welcome to Elem-Go")), + elem.Raw(rawHTML), // Inserting the raw HTML + elem.P(nil, elem.Text("More content here...")), +) + +htmlOutput := content.Render() +// Output:

Welcome to Elem-Go

Custom HTML content

More content here...

+``` + +### HTML Comments Apart from standard elements, `elem-go` also allows you to insert HTML comments using the `Comment` function: