-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.go
34 lines (25 loc) · 1.41 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
Package godom provides a comprehensive and fluent API for creating and manipulating DOM structures in Go.
The GoDOM library is inspired by the gomponents library, but it offers a unique take on DOM manipulation in Go.
Instead of merely creating strings of HTML, GoDOM focuses on maintaining a live DOM-like structure, making it easier to manipulate,
extend, and integrate with other Go packages.
Core Concepts:
1. **Elements**: At the heart of the library are Elements, which represent individual HTML elements. Elements can be nested, allowing for the creation of complex DOM structures.
2. **Attributes**: Attributes allow for the modification of Elements, adding things like classes, IDs, and other HTML attributes.
3. **Helpers**: The library provides helper functions for every HTML5 tag and attribute, making it easy to build any HTML structure.
4. **Utilities**: GoDOM provides utilities that allow for conditional rendering of elements and attributes, delayed rendering, and more.
Usage:
To create and render a simple HTML structure:
```go
doc := Div(Class("container"))(
H1()(Content("Hello, GoDOM!")),
P()(Content("This is a simple example.")),
)
var buf bytes.Buffer
doc.Render(&buf)
fmt.Println(buf.String())
```
The GoDOM library can be extended with the template and util packages for more functionality.
For more complex examples and use cases, refer to the README and other package documentations.
*/
package godom