-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
alert.go
58 lines (47 loc) · 1.81 KB
/
alert.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
package markdown
import "fmt"
// Note set text with note format.
func (m *Markdown) Note(text string) *Markdown {
m.body = append(m.body, fmt.Sprintf("> [!NOTE] \n> %s", text))
return m
}
// Notef set text with note format. It is similar to fmt.Sprintf.
func (m *Markdown) Notef(format string, args ...interface{}) *Markdown {
return m.Note(fmt.Sprintf(format, args...))
}
// Tip set text with tip format.
func (m *Markdown) Tip(text string) *Markdown {
m.body = append(m.body, fmt.Sprintf("> [!TIP] \n> %s", text))
return m
}
// Tipf set text with tip format. It is similar to fmt.Sprintf.
func (m *Markdown) Tipf(format string, args ...interface{}) *Markdown {
return m.Tip(fmt.Sprintf(format, args...))
}
// Important set text with important format.
func (m *Markdown) Important(text string) *Markdown {
m.body = append(m.body, fmt.Sprintf("> [!IMPORTANT] \n> %s", text))
return m
}
// Importantf set text with important format. It is similar to fmt.Sprintf.
func (m *Markdown) Importantf(format string, args ...interface{}) *Markdown {
return m.Important(fmt.Sprintf(format, args...))
}
// Warning set text with warning format.
func (m *Markdown) Warning(text string) *Markdown {
m.body = append(m.body, fmt.Sprintf("> [!WARNING] \n> %s", text))
return m
}
// Warningf set text with warning format. It is similar to fmt.Sprintf.
func (m *Markdown) Warningf(format string, args ...interface{}) *Markdown {
return m.Warning(fmt.Sprintf(format, args...))
}
// Caution set text with caution format.
func (m *Markdown) Caution(text string) *Markdown {
m.body = append(m.body, fmt.Sprintf("> [!CAUTION] \n> %s", text))
return m
}
// Cautionf set text with caution format. It is similar to fmt.Sprintf.
func (m *Markdown) Cautionf(format string, args ...interface{}) *Markdown {
return m.Caution(fmt.Sprintf(format, args...))
}