You can convert html to a string
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 233
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 8
Description
`html.replace`
in
`String(html).replace`
And this error does not occur when working with SVG files
```/resourses/node_modules/juice/lib/cheerio.js:19
html = html.replace(re, function(match, subMatch) {
^
TypeError: html.replace is not a function
at /home/rtx/resourses/node_modules/juice/lib/cheerio.js:19:17
at Array.forEach (native)
at encodeCodeBlocks (/home/rtx/resourses/node_modules/juice/lib/cheerio.js:17:23)
at encodeEntities (/home/rtx/resourses/node_modules/juice/lib/cheerio.js:38:10)
at cheerioLoad (/home/rtx/resourses/node_modules/juice/lib/cheerio.js:11:10)
at module.exports (/home/rtx/resourses/node_modules/juice/lib/cheerio.js:55:11)
at /home/rtx/resourses/node_modules/juice/client.js:16:10
at juiceFile (/home/rtx/resourses/toAttribute.js:13:12)
at withFile (/home/rtx/resourses/toAttribute.js:22:28)
at callIterator (/home/rtx/resourses/node_modules/each-file/index.js:46:7)
```
Contributor guide
Research direction
Start in node_modules/juice/lib/cheerio.js, especially encodeCodeBlocks where html.replace is called, and reproduce the reported TypeError with the HTML input. Verify that the reported HTML case no longer fails while the existing SVG behavior remains unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100