You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62-20Lines changed: 62 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# GitBook Plugin: Flexible Alerts
2
2
3
-
This GitBook Plugin converts blockquotes into beautiful alerts. Look and feel can be configured so the alerts fit your needs (some examples are shown below).
3
+
This GitBook Plugin converts blockquotes into beautiful alerts. Look and feel can be configured on a global as well as on a alert specific level so output does fit your needs (some examples are shown below). In addition, you can provide own alert types.
4
4
5
5

6
6
@@ -9,7 +9,7 @@ This GitBook Plugin converts blockquotes into beautiful alerts. Look and feel ca
9
9
### Step #1 - Update book.json file
10
10
11
11
1. In you gitbook's book.json file, add `flexible-alerts` to plugins list.
12
-
2. In pluginsConfig, set base value which is base path to your github or gitlab or other code repo. Trailing slash is NOT required.
12
+
2. In pluginsConfig, configure the plugin so it does fit your needs. A custom setup is not mandatory.
13
13
3. By default style 'callout' and headings 'Note', 'Tip', 'Warning', 'Attention' will be used. You can change it using plugin configuration via `book.json` or for a single alert in your markdown files.
14
14
15
15
**Sample `book.json` file for gitbook version 2.0.0+**
@@ -46,10 +46,18 @@ This GitBook Plugin converts blockquotes into beautiful alerts. Look and feel ca
46
46
],
47
47
"pluginsConfig": {
48
48
"flexible-alerts": {
49
-
"note": "Hinweis",
50
-
"tip": "Tipp",
51
-
"warning": "Warnung",
52
-
"danger": "Achtung"
49
+
"note": {
50
+
"label": "Hinweis"
51
+
},
52
+
"tip": {
53
+
"label": "Tipp"
54
+
},
55
+
"warning": {
56
+
"label": "Warnung"
57
+
},
58
+
"danger": {
59
+
"label": "Achtung"
60
+
}
53
61
}
54
62
}
55
63
}
@@ -65,20 +73,28 @@ This GitBook Plugin converts blockquotes into beautiful alerts. Look and feel ca
65
73
"pluginsConfig": {
66
74
"flexible-alerts": {
67
75
"note": {
76
+
"label": {
68
77
"de": "Hinweis",
69
78
"en": "Note"
79
+
}
70
80
},
71
81
"tip": {
82
+
"label": {
72
83
"de": "Tipp",
73
84
"en": "Tip"
85
+
}
74
86
},
75
87
"warning": {
88
+
"label": {
76
89
"de": "Warnung",
77
90
"en": "Warning"
91
+
}
78
92
},
79
93
"danger": {
94
+
"label": {
80
95
"de": "Achtung",
81
96
"en": "Attention"
97
+
}
82
98
}
83
99
}
84
100
}
@@ -94,12 +110,7 @@ Note: Above snippets can be used as complete `book.json` file, if one of these m
94
110
95
111
## Usage
96
112
97
-
To use the plugin just modify an existing blockquote and prepend a line matching pattern `[!type]`, using one of following types. Please see code snippets for working alerts.
98
-
99
-
* NOTE
100
-
* TIP
101
-
* WARNING
102
-
* DANGER
113
+
To use the plugin just modify an existing blockquote and prepend a line matching pattern `[!type]`. By default types `NOTE`, `TIP`, `WARNING` and `DANGER` are supported. You can extend the available types by providing a valid configuration (see below for an example).
103
114
104
115
```markdown
105
116
> [!NOTE]
@@ -111,28 +122,59 @@ To use the plugin just modify an existing blockquote and prepend a line matching
111
122
> An alert of type 'note' using alert specific style 'flat' which overrides global style 'callout'.
112
123
```
113
124
114
-
As you can see in the second snippet output can be configured on alert level also. Supported options are listed in following table:
125
+
As you can see in the second snippet, output can be configured on alert level also. Supported options are listed in following table:
115
126
116
127
| Key | Allowed value |
117
128
| --------------- | ---- |
118
-
| style | callout, flat |
119
-
| label | any text |
120
-
| labelVisibility | visible (default), hidden |
121
-
| iconVisibility | visible (default), hidden |
129
+
| style | One of follwowing values: callout, flat |
130
+
| label | Any text |
131
+
| icon | A valid Font Awesome icon, e.g. 'fa-info-circle' |
132
+
| className | A name of a CSS class which specifies the look and feel |
133
+
| labelVisibility | One of follwowing values: visible (default), hidden |
134
+
| iconVisibility | One of follwowing values: visible (default), hidden |
122
135
123
136
Multiple options can be used for single alerts as shown below:
124
137
125
138
```markdown
126
-
> [!NOTE|style:flat|label:My own heading|iconVisibility:false]
127
-
> An alert of type 'note' using alert specific style 'flat' which overrides global style 'callout'.
139
+
> [!TIP|style:flat|label:My own heading|iconVisibility:false]
140
+
> An alert of type 'tip' using alert specific style 'flat' which overrides global style 'callout'.
128
141
> In addition, this alert uses an own heading and hides specific icon.
As mentioned above you can provide your own alert types. Therefore, you have to provide the type configuration via `book.json`. Following example shows an additional type `COMMENT`.
147
+
148
+
```json
149
+
{
150
+
"plugins": [
151
+
"flexible-alerts"
152
+
],
153
+
"pluginsConfig": {
154
+
"flexible-alerts": {
155
+
"style": "callout",
156
+
"comment": {
157
+
"label": "Comment",
158
+
"icon": "fa-comments",
159
+
"className": "info"
160
+
}
161
+
}
162
+
}
163
+
}
164
+
```
165
+
166
+
In Markdown just use the alert according to the types provided by default.
167
+
168
+
```markdown
169
+
> [!COMMENT]
170
+
> An alert of type 'comment' using style 'callout' with default settings.
171
+
```
172
+
173
+

174
+
133
175
## Troubleshooting
134
176
135
177
If alerts do no look as expected, check if your `book.json` as well as alerts in Markdown are valid according to this documentation.
0 commit comments