Thanks for using EmEditor Professional!
If I understand your question correctly, “HTML Tidy” might work best for you. An example as to how you configure an external tool, please see the EmEditor Professional 9 feature page or http://www.emeditor.com/images/emeditor9_tool_prop_e.png
Please let me know if you have further questions. Thank you!