Skip to content

Commit efc1966

Browse files
authored
feat(tag): add pandown (#785)
1 parent f6f166e commit efc1966

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

scripts/tags/pandown.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use strict';
2+
3+
// {% pandown type, url, pwd, fname %}
4+
hexo.extend.tag.register('pandown', function(args) {
5+
if(/::/g.test(args)){
6+
args = args.join(' ').split('::');
7+
}
8+
else{
9+
args = args.join(' ').split(',');
10+
}
11+
let type = '';
12+
let url = '';
13+
let pwd = '';
14+
let fname = '';
15+
if (args.length < 4) {
16+
return;
17+
} else if (args[0].trim() === 'yun') {
18+
return '<p>对不起,pandown-tags不支持自定义</p><br><p>Sorry, pandown-tags does not support customization</p>'
19+
} else {
20+
type = args[0].trim();
21+
url = args[1].trim();
22+
pwd = args[2].trim();
23+
fname = args[3].trim();
24+
}
25+
let result = '';
26+
// js
27+
result += '<div class="tag pandown-tags"><script type="text/javascript" src="https://unpkg.com/pandown"></script>';
28+
//pandown
29+
result += '<pandown type="'+type+'" url="'+url+'" pwd="'+pwd+'" fname="'+fname+'"></pandown>'
30+
//调用
31+
result += '<script>pandown()</script></div>'
32+
return result;
33+
});

0 commit comments

Comments
 (0)