There are a couple of tools that could be used for this purpose. Some of them require HTML and some XML Confluence space export.

This tool is interesting, since it does not have any dependency, you can simply run the script.

The other option is Metamug.

It is convenient since it will remove any unnecessary HTML content (styles and other).