Skip to content

Commit 40a6cef

Browse files
author
Anonymous Indian
committed
Content should use NodeElement
Added up helpers for Contents to make Nodes from HTMLs
1 parent e0c8625 commit 40a6cef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/example.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ func main() {
1818

1919
// The Telegraph API uses a DOM-based format to represent the content of the page.
2020
// https://telegra.ph/api#Content-format
21-
_, err = a.CreatePage("Sample Page 1", `[{"tag":"h3", "children":["A Sample Page #1"]}, {"tag":"p", "children":["Hello world! This telegraph page is created using telegraph-go package."]}]`, &telegraph.PageOpts{
21+
_, err = a.CreatePage("Sample", `<h3>Sample Page #1</h3> <p>Hello world! This telegraph page is created using telegraph-go package.</p><br><a href="https://github.com/anonyindian/telegraph-go">Click here to open package</a>`, &telegraph.PageOpts{
2222
AuthorName: "User1",
2323
})
2424
if err != nil {
2525
fmt.Println(err.Error())
2626
}
2727

28-
_, err = a.CreatePage("Sample Page 2", `[{"tag":"h3", "children":["A Sample Page #2"]}, {"tag":"p", "children":["Hello world! This telegraph page is created using telegraph-go package."]}]`, &telegraph.PageOpts{
28+
_, err = a.CreatePage("Sample", `<h3>Sample Page #2</h3> <p>Hello world! This telegraph page is created using telegraph-go package.</p>`, &telegraph.PageOpts{
2929
AuthorName: "User1",
3030
})
3131
if err != nil {

0 commit comments

Comments
 (0)