AppleScript to beautify HTML?

Does it exist an AppleScript solution to beautify HTML? Looking for something that can be added to the Script Menu and used system wide wherever there is text, similar to Free Online HTML Formatter - FreeFormatter.com

You can probably use this API in AppleScript: