apostrophecms / sanitize-html

Clean up user-submitted HTML, preserving whitelisted elements and whitelisted attributes on a per-element basis. Built on htmlparser2 for speed and tolerance
MIT License
3.68k stars 349 forks source link

Asynchronous transformTags call #626

Closed Stanislavussov closed 1 year ago

Stanislavussov commented 1 year ago

Hi, I met problem in case when I want to make some API call inside transformTags function it never be awaited. As I understand sanitize-html does not support async calls in itself. Maybe somebody knows any workaround how to make it work?

Thanks

boutell commented 1 year ago

sanitize-html is meant to be a very fast library for sanitizing of user input. If you need to make API calls I suggest checking out something like cheerio which lets you load the document, manipulate it with a full jQuery-like API (but not just in the browser), and generate the HTML again when you're ready after doing whatever you wish.