Merge pull request #18 from Core00077/master
确保了cheerio返回非html实体编码,同时修复了hexo主页上emoji不能正常显示的问题
This commit is contained in:
commit
222ea40102
1 changed files with 4 additions and 1 deletions
5
index.js
5
index.js
|
@ -29,7 +29,8 @@ if (options.enable !== false) {
|
|||
hexo.extend.filter.register('after_post_render', data => {
|
||||
if (!options.inject && data['no-emoji']) { return data }
|
||||
|
||||
const $ = cheerio.load(data.content)
|
||||
const $ = cheerio.load(data.content, {decodeEntities: false})
|
||||
const excerpt = cheerio.load(data.excerpt,{decodeEntities: false})
|
||||
|
||||
if (options.inject) {
|
||||
$('body').append(`<script>
|
||||
|
@ -55,9 +56,11 @@ if (options.enable !== false) {
|
|||
|
||||
if (!data['no-emoji']) {
|
||||
replaceColons($('body')[0], $, emojis)
|
||||
replaceColons(excerpt('body')[0], excerpt, emojis)
|
||||
}
|
||||
|
||||
data.content = $('body').html()
|
||||
data.excerpt = excerpt('body').html()
|
||||
return data
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue