forked from ztmd/highlight-pug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
71 lines (68 loc) · 2.07 KB
/
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
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
function highlightPug(hljs) {
var TAG_SELECTORS = 'abbr|acronym|address|area|article|aside|audio|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video|a|input';
return {
case_insensitive: false,
aliases: ['jade'],
keywords: {
keyword: 'define if else unless each for in elseif var const let while do import include block extends switch case when default break continue until append prepend'
},
contains: [
// string
{
className: 'string',
begin: '`', end: '`',
illegal: '\\n',
contains: [hljs.BACKSLASH_ESCAPE]
},
// doctype
{
className: 'comment',
begin: 'doctype.*',
relevance: 0
},
// variable
{
className: 'variable',
relevance: 0,
variants: [
{
begin: '\\#{', end: '\\}', excludeBegin: true, excludeEnd: true
},
{
begin: '\\${', end: '\\}', excludeBegin: true, excludeEnd: true
}
]
},
// comment
{
className: 'comment',
begin: /\/\/-?.*/
},
// tag
{
className: 'selector-tag',
begin: '\\b(' + TAG_SELECTORS + ')\\b'
},
// id
{
className: 'selector-id', begin: /#[A-Za-z0-9_-]+/
},
// class
{
className: 'type', begin: /\.[A-Za-z0-9_-]+/
},
// attributes
{
className: 'attribute',
begin: '&attributes',
relevance: 0
},
// symbol
{
className: 'symbol',
begin: /[=,:?!]|\.($|\n)/
}
]
};
}
module.exports = highlightPug;