forked from kilbot/plugin-hints
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (32 loc) · 917 Bytes
/
index.js
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
var CLASSES = {
info:'info',
tip:'success',
danger:'danger',
working:'warning'
};
function makeIcon(name) {
return '<i class="fa fa-'+name+'" style=""></i>';
}
var ICONS = {
info: makeIcon('info-circle'),
tip: makeIcon('mortar-board'), // Diploma hat
danger: makeIcon('exclamation-triangle'),
working: makeIcon('wrench')
};
module.exports = {
blocks: {
hint: {
process: function (block) {
// Available styles: info, danger, tip, working
var style = block.args[0].trim() || 'info';
return this.renderInline("markdown", block.body)
.then(function(str){
return '<div class="alert alert-'+CLASSES[style]+'">'
+ ICONS[style]
+ str
+ '</div>';
});
}
}
}
};