So, it requires some amount of work, but it is possible to implement this yourself.
All steps would be too much to explain here, but I've encountered the exact same problem. I wanted to sanitize HTML contents as whole documents, and had to find out the hard way, how the library works under the hood.
In short:
I've explained the approach in detail for a use-case based on shopware on my blog: https://machinateur.dev/blog/how-to-sanitize-full-html-5-documents-with-htmlpurifier.