-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
fix: compatibility with cheerio 1.0.0+ (#3313) #3315
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I should create a test case, learning... Edit: Added a test case. |
@@ -0,0 +1,28 @@ | |||
'use strict'; | |||
|
|||
const should = require('chai').should(); // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were changed to use globally chai.should
in this commit.
So, no need this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
const should = require('chai').should(); // eslint-disable-line | ||
|
||
describe('Meta Generator', function() { | ||
const Hexo = require('../../../lib/hexo'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, We are migrating hexo code to ES6 syntax.
Would you please change to arrow function ? Also others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
Other implementation and test code I will review later. |
LGTM! Thanks! |
I think this caused the problem. Can you fix it? |
Fix #3313. Related to #3129.
<html><head><body>
are automatically added to every empty or open tag (see Automatically adding <html><head><body> ? cheeriojs/cheerio#1031 All examples are broken for v1.0.0 (rc2) - cheerio outputs html-tags cheeriojs/cheerio#1239). If I have<p>
, it will results in,<head>
. e.g.<html><head><body>
are stripped away in the final$.html()
, leavingAs a workaround, meta_generator.js prepend only to non-empty real
<head>
. I assume Hexo page has at least meta charset or css in the<head>
.Without this workaround, if I use any plugin that uses cheerio 1.0.0+ (e.g. hexo-nofollow), meta_generator will also prepend tag to
<body>
(see curbengh/hexo-testing@f4824bb).Thank you for creating a pull request to contribute to Hexo code! Before you open the request please review the following guidelines and tips to help it be more easily integrated:
cc @h404bi