forked from ztmd/highlight-pug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
41 lines (30 loc) · 797 Bytes
/
test.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
'use strict';
const hljs = require('highlight.js');
const highlightPug = require('./pug');
hljs.registerLanguage('pug', highlightPug);
const pug = `doctype html
html
head
include ./head
body
.nmr
h1 网易云音乐推荐
block content
if config.github
include ./github
if script
script!=script
else
script(src="./js/index.js")
a(target="_blank" href=\`https://music.163.com/artist?id=\${artist.id}\`)=artist.name
`;
const pug2 = `
div#foo(data-bar="foo")&attributes({'data-foo': 'bar'})
`;
const ret = hljs.highlight('pug', pug);
const ret2 = hljs.highlight('pug', pug2);
console.log('--------------------');
console.log(ret.value);
console.log('--------------------');
console.log(ret2.value);
console.log('--------------------');