cheerio
cheerio copied to clipboard
Impact of options is hard to understand
I am passing
const $ = cheerio.load("<div> > Hello world </div>", { decodeEntities: false }, false) // tried true and false for decodeEntities
return $.html()
We want it to return <div> > Hello world </div>
, but it's returning <div> > Hello world </div>
instead.
Not the maintainer, but decodeEntities
controls the opposite - if >
in the input should become >
in the output.
I think you want xmlMode: true
instead.
That's almost the answer: The reason why decodeEntities
doesn't work is that it is an option for htmlparser2, which isn't the default parser. Have a look at https://github.com/cheeriojs/cheerio#using-htmlparser2 for more details. The easiest way around this is probably by using the slim
export.
Leaving this open to track the deeper issue.