-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathhighlight.js
More file actions
44 lines (35 loc) · 972 Bytes
/
highlight.js
File metadata and controls
44 lines (35 loc) · 972 Bytes
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
'use strict';
const emphasize = require('emphasize');
const chalk = require('chalk');
const windows = process.platform === 'win32';
const sheet = {
'comment': chalk.gray,
'quote': chalk.gray,
'keyword': chalk.green,
'addition': chalk.green,
'number': windows ? chalk.yellow : chalk.blue,
'string': chalk.green,
'meta meta-string': chalk.cyan,
'literal': chalk.cyan,
'doctag': chalk.cyan,
'regexp': chalk.cyan,
'attribute': undefined,
'attr': undefined,
'variable': chalk.yellow,
'template-variable': chalk.yellow,
'class title': chalk.yellow,
'type': chalk.yellow,
'symbol': chalk.magenta,
'bullet': chalk.magenta,
'subst': chalk.magenta,
'meta': chalk.magenta,
'meta keyword': chalk.magenta,
'link': chalk.magenta,
'built_in': chalk.cyan,
'deletion': chalk.red,
'emphasis': chalk.italic,
'strong': chalk.bold,
'formula': chalk.inverse,
};
module.exports = (s) =>
emphasize.highlight('js', s, sheet).value;