-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Get unescaped html #4029
Comments
In case this helps, if you read the console.log($('a').attr('href'));
// https://www.google.com/maps/search/?api=1&query=NEW+YORK Cheerio's behavior is consistent with how browsers work. You can prove this to yourself by executing this in a browser: const el = document.createElement('div');
el.innerHTML = '<a href="https://www.google.com/maps/search/?api=1&query=NEW+YORK">NEW YORK</a>';
console.log(el.innerHTML);
// <a href="https://www.google.com/maps/search/?api=1&query=NEW+YORK">NEW YORK</a> |
Thank you for the explanation. The use case I have is that I have html files that I need to manipulate and save back. So I think that it makes sense that there will be another method that will export the html without escaping |
I suspect that's outside the scope of this library. You might consider using a third-party library like |
Thanks |
I need to get the html with hyperlinks not escaped.
consider this example:
What I get in the console is
<a href="https://www.google.com/maps/search/?api=1&query=NEW+YORK">NEW YORK</a>
with&
. I need to get it with&
like in the source.I think that there is need for an option on the
html
function to not escape the result HTMLThe text was updated successfully, but these errors were encountered: