Skip to content

Commit

Permalink
docs: filter method (bubkoo#328)
Browse files Browse the repository at this point in the history
subject: doc filter method working error

modified:   README.md
  • Loading branch information
happy-func authored and istaiti committed Feb 7, 2023
1 parent 9f31598 commit 2f3d101
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -190,10 +190,10 @@ A function taking DOM node as argument. Should return true if passed node should

You can add filter to every image function. For example,

```js
const filter = (node)=>{
```ts
const filter = (node: HTMLElement) => {
const exclusionClasses = ['remove-me', 'secret-div'];
return !exclusionClasses.some(classname=>node.classList.includes(classname));
return !exclusionClasses.some((classname) => node.classList?.contains(classname));
}

htmlToImage.toJpeg(node, { quality: 0.95, filter: filter});
Expand Down

0 comments on commit 2f3d101

Please sign in to comment.