Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop cheerio #1299

Merged
merged 3 commits into from
Dec 3, 2019
Merged

Drop cheerio #1299

merged 3 commits into from
Dec 3, 2019

Conversation

stevenjoezhang
Copy link
Contributor

No description provided.

@ivan-nginx
Copy link
Member

Codacy Here is an overview of what got changed by this pull request:

Issues
======
+ Solved 2
           

See the complete overview on Codacy

@stevenjoezhang stevenjoezhang mentioned this pull request Dec 3, 2019
33 tasks
@1v9 1v9 requested review from jiangtj and removed request for sli1989, maple3142 and ivan-nginx December 3, 2019 12:10
@1v9
Copy link
Member

1v9 commented Dec 3, 2019

We never have any test case but seems everything's ok 😘

@maple3142
Copy link
Contributor

I wonder why replace cheerio with regex..?

@stevenjoezhang
Copy link
Contributor Author

hexojs/hexo#3850

"dependencies": {
-    "cheerio": "0.22.0",
  },
  "devDependencies": {
+    "cheerio": "0.22.0",
  }

@maple3142
Copy link
Contributor

But... use regex to handle html? Why not just a use another html parser or similar tools such as jsdom or other lightweight alternative?
Regex shouldn't be used to parse html for any serious purpose.

@stevenjoezhang
Copy link
Contributor Author

Why not just a use another html parser or similar tools such as jsdom or other lightweight alternative?

Please note: Currently the theme is installed via git clone instead of npm install. Using any non-Hexo dependent package will get the same result: Error: Cannot find module xxx

@jiangtj
Copy link
Member

jiangtj commented Dec 4, 2019

另一个方案是,重写md渲染器
优点:更快
缺点:特定的功能模块只能使用内置的md渲染器,维护成本增加

比如:jiangtj/hexo-theme-cake#28 提供了disable_cake_marked禁用内置的md渲染,但禁用后,图片懒加载功能失效

@stevenjoezhang
Copy link
Contributor Author

维护一个主题已经很累了。渲染器不关我的事,谁爱管谁管。

@jiangtj
Copy link
Member

jiangtj commented Dec 4, 2019

维护一个主题已经很累了。渲染器不关我的事,谁爱管谁管。

😂 这几天在研究这个,hexo如果只用一个固定的md渲染器,整体性能应该能提高至少50%

@stevenjoezhang
Copy link
Contributor Author

stevenjoezhang commented Dec 4, 2019

确实如此,而且像 hexo-renderer-kramed 这种已经几年没更新了 https://www.npmjs.com/package/hexo-renderer-kramed 有兴趣的话可以发邮件给npm接手这个包。
如果Hexo的渲染器有插件的接口,并且给主题调用的方法,那么就可以高效地解决问题。但这还没有被纳入Hexo的标准,有兴趣的话可以向Hexo提一下建议。

npm
Markdown renderer plugin for Hexo with kramed engine

voidking pushed a commit to voidking/hexo-theme-next-2021 that referenced this pull request Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants