Comments (14)
const $ = cheerio.load(data.content)
改为const $ = cheerio.load(data.content,{decodeEntities: false})
jquery拿到的元素则没有做html实体编码。
目前测试是没有太大问题。我会再检查一下,没有问题后给你提个pr。
谢谢大佬帮助!
from hexo-filter-github-emojis.
你好,确定是这个插件的问题吗?据我所知这个插件没有做这样的替换。
from hexo-filter-github-emojis.
确定,因为当我config下不启用这个插件的时候就没有问题了。我刚刚把插件关了并clean后重新deploy到服务器,没有出现描述的问题。
from hexo-filter-github-emojis.
这可能是跟某个插件冲突了,或者是文本编码的问题?很可能跟这里有关
hexo-filter-github-emojis/index.js
Line 32 in 975a324
因为我现在不用 Hexo 了,之前的博客也没出现这样的问题,所以就不去折腾你的环境了。你可以提 PR 修复或者去掉本插件。
from hexo-filter-github-emojis.
好的谢谢大佬。刚刚在调试此插件,的确会将文本变成编码。我如果发现问题了再提个pr。
from hexo-filter-github-emojis.
刚刚调试的时候发现cheerio拿到的data.content是正常的。在replaceColons($('body')[0], $, emojis)
调用的时候出现问题。然后data被放回了全都编码了的content。
目前猜测和data['no-emoji']
有关,因为返回的是undefined
from hexo-filter-github-emojis.
如果可以的话,想请教一下data['no-emoji']是怎样使用的
目前调试的过程中以下两处判断均不符合预期。
hexo-filter-github-emojis/index.js
Line 30 in 975a324
这行的目的应该是判断文章是否含有emoji,对没有emoji的文章直接跳过。而在处理一篇我确定没有emoji字符的文章里它仍然返回true并进行了处理。
hexo-filter-github-emojis/index.js
Line 56 in 975a324
同上。
from hexo-filter-github-emojis.
啊,那应该冲突是在这里了
hexo-filter-github-emojis/index.js
Lines 75 to 77 in 975a324
对比你的搜索插件生成的 HTML 。
no-emoji
那个见文档,是一项 front matter 选项,跟这里无关。
from hexo-filter-github-emojis.
呃的确是这个问题,no-emoji
是我没注意。的确是替换出了问题。
不过我留意到
hexo-filter-github-emojis/index.js
Lines 56 to 61 in 975a324
这一段即使没有进入到
replaceColons($('body')[0], $, emojis)
方法之前,$('body').html()
在控制台的输出也是html实体编码。from hexo-filter-github-emojis.
那就是前面第一段 cheerio.load
出的问题咯
from hexo-filter-github-emojis.
我还是倾向你的 HTML 文本编码在这里产生了冲突,可以检查一下 cheeriojs/cheerio#866
from hexo-filter-github-emojis.
你是对的,cheerio上issue和我的情况一样。
from hexo-filter-github-emojis.
#18
感谢大佬指点,话说npm那边是实时更新的吗还是得等一段时间?
from hexo-filter-github-emojis.
已发布
from hexo-filter-github-emojis.
Related Issues (20)
- About the Emoji's Style HOT 4
- Customize the emoji size HOT 1
- The escape code becomes `<img>` HOT 4
- Script data shown in short abstracts HOT 3
- this plugin overwrites the directory of img HOT 4
- A resource from Github can't be loaded HOT 3
- 安装完成 hexo-filter-github-emojis 后执行 hexo clean报错 HOT 2
- Some links of emoji have expired HOT 2
- Can it works on my index page? Thanks. HOT 4
- 显示问题 HOT 14
- Not compatable with my other plugins HOT 2
- 在表格中无法显示 HOT 1
- no support win10 HOT 2
- Update lodash to v 4.17.21 HOT 1
- Failed to install github emojis HOT 2
- Installation failed HOT 2
- Warning after install this script HOT 3
- About the Hexo's "null" HOT 1
- Bug: additional capital of the emoji HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hexo-filter-github-emojis.