-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwriter_test.go
76 lines (60 loc) · 2.14 KB
/
writer_test.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package gomarkdown
import (
"testing"
)
// TestMarkdownWriter tests all the functions of the gomarkdown package
func TestMarkdownWriter(t *testing.T) {
// Create a new MarkdownWriter instance
mw, err := NewMarkdownWriter("example", false)
if err != nil {
t.Fatal(err)
}
// Testing different Markdown elements
mw.H1("Heading Level 1")
mw.H2("Heading Level 2")
mw.H3("Heading Level 3")
mw.H4("Heading Level 4")
mw.H5("Heading Level 5")
mw.H6("Heading Level 6")
mw.Hr()
mw.Bold("Bold Text Example")
mw.Italic("Italic Text Example")
mw.Strikethrough("Strikethrough Text Example")
mw.InlineCode("Inline Code Example")
mw.Footnote("1", "This is a footnote example.")
mw.Highlight("Highlighted Text Example")
mw.CustomHTML("<p>This is custom HTML content.</p>")
mw.Code("go", `fmt.Println("Hello, Go!")`)
mw.List([]string{"Item 1", "Item 2", "Item 3"})
mw.OrderedList([]string{"First", "Second", "Third"})
mw.Link("Go to Google", "https://www.google.com")
mw.Image("Go Logo", "https://golang.org/doc/gopher/frontpage.png")
mw.ImageWithSize("Go Logo", "https://golang.org/doc/gopher/frontpage.png", 100, 100)
mw.ImageWithScale("Go Logo", "https://golang.org/doc/gopher/frontpage.png", 30)
mw.Quote("This is a blockquote example.")
mw.Subscript("Subscript Example")
mw.Superscript("Superscript Example")
definitions := []*DefinitionList{
{Term: "Term 1", Definition: "Definition for Term 1"},
{Term: "Term 2", Definition: "Definition for Term 2"},
}
mw.DefinitionList(definitions)
mw.TableOfContents([]string{"Heading Level 1", "Heading Level 2", "Heading Level 3"})
mw.Table([]string{"Header 1", "Header 2"}, [][]string{
{"Row 1, Col 1", "Row 1, Col 2"},
{"Row 2, Col 1", "Row 2, Col 2"},
})
taskItems := []*TaskModel{
{Text: "Task 1", Done: true},
{Text: "Task 2", Done: false},
}
mw.TaskList(taskItems)
mw.AlertBox("note", "This is a note alert.")
mw.AlertBox("warning", "This is a warning alert.")
mw.AlertBox("danger", "This is a danger alert.")
mw.SequenceDiagram("Alice -> Bob: Hello Bob!")
mw.Flowchart("A-->B")
mw.MermaidDiagram("graph TD; A-->B;")
mw.CodeBlockMath("E = mc^2")
mw.InlineMath("a^2 + b^2 = c^2")
}