0%

解决hexo-pdf无法使用的问题

下载hexo-pdf后,修改index.js中的代码将tag名修改为非pdf即可
我这里修改为pdfpath
之前修改为pdf-path也不能正常运行,pdf应该时不能单独出现的

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
/**
* hexo-pdf
* https://github.com/superalsrk/hexo-pdf.git
* Copyright (c) 2015, superalsrk
* Licensed under the MIT license.
* Syntax:
* {% pdf http://yourdoman.com/x.pdf %} %}
**/

var ejs = require('ejs'),
path = require('path'),
fs = require('fs')

hexo.extend.tag.register('pdfpath', function(args){
var htmlTmlSrc = path.join(__dirname, 'reader.ejs');
var htmlTml = ejs.compile(fs.readFileSync(htmlTmlSrc, 'utf-8'))

var type = 'normal';
var pdfLink = args[0];

if (pdfLink.indexOf('.pdf') > 0) {
type = 'normal'
}
else if(pdfLink.indexOf('drive.google.com') > 0) {
type = 'googledoc'
}
else if(pdfLink.indexOf('www.slideshare.net') > 0) {
type = 'slideshare'
}
return htmlTml({"src": args[0], "type" : type});


});


Buy me a coffee.

欢迎关注我的其它发布渠道