Skip to content

Commit

Permalink
Add documentation on RenderWithOptions to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
chasefleming committed Dec 21, 2023
1 parent 4f0bd60 commit 7c90416
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,20 @@ The `.Render()` method is used to convert the structured Go elements into HTML s
html := content.Render()
```

In this example, content refers to an elem element structure. When the `.Render()` method is called on content, it generates the HTML representation of the constructed elements.
In this example, `content` refers to an `elem` element structure. When the `.Render()` method is called on content, it generates the HTML representation of the constructed elements.

> NOTE: When using an <html> element, this method automatically includes a <!DOCTYPE html> preamble in the rendered HTML, ensuring compliance with modern web standards.
#### Custom Rendering Options

For more control over the rendering process, such as disabling the HTML preamble, use the `RenderWithOptions` method. This method accepts a `RenderOptions` struct, allowing you to specify various rendering preferences.

```go
options := RenderOptions{DisableHtmlPreamble: true}
htmlString := myHtmlElement.RenderWithOptions(options)
```

This flexibility is particularly useful in scenarios where default rendering behaviors need to be overridden or customized.

### Generating Lists of Elements with `TransformEach`

Expand Down

0 comments on commit 7c90416

Please sign in to comment.