-
Notifications
You must be signed in to change notification settings - Fork 43
/
text.go
54 lines (50 loc) · 1.09 KB
/
text.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
package gowd
import "golang.org/x/net/html"
const (
//BoldText <b>
BoldText = "b"
//StrongText <strong>
StrongText = "strong"
//ItalicText <i>
ItalicText = "i"
//EmphasizedText <em>
EmphasizedText = "em"
//MarkedText <mark>
MarkedText = "mark"
//SmallText <small>
SmallText = "small"
//DeletedText <del>
DeletedText = "del"
//InsertedText <ins>
InsertedText = "ins"
//SubscriptText <sub>
SubscriptText = "sub"
//SuperscriptText <sup>
SuperscriptText = "sup"
//TitleText <title>
TitleText = "title"
//Paragraph <p>
Paragraph = "p"
//Heading1 <h1>
Heading1 = "h1"
//Heading2 <h2>
Heading2 = "h2"
//Heading3 <h3>
Heading3 = "h3"
//Heading4 <h4>
Heading4 = "h4"
//Heading5 <h5>
Heading5 = "h5"
//Heading6 <h6>
Heading6 = "h6"
)
//NewText creates new text node (without HTML tag)
func NewText(text string) *Element {
return &Element{nodeType: html.TextNode, data: elementText(text)}
}
//NewStyledText creates new text element using a specific style
func NewStyledText(text string, style string) *Element {
txt := NewElement(style)
txt.AddElement(NewText(text))
return txt
}