File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments