Code formatting in code mirror

Unable to find any function in codemirror documentation to format code? Any approach how to do this?

The library doesn’t do this.

Any other approach to acheive this functionality?

I use Prettier to do this on CodeMirror content. While mainly Node JS based, there’s a browser component in JS that will format quite a few languages:

Anything for C/C++/Java/Python? Prettier will work this Javascript only.