Yes. The clean way is to add a Webmin File Manager context-menu action that appears for .html/`.htm` files and runs Prettier on the selected file.
Since you want to keep Webmin's existing functionality intact, I would add this as a separate File Manager action rather than replace the editor.
Proposed behavior
Right-click:
Webmin context menu:
Open
Edit
...
──────────────
Format HTML with Prettier
When selected:
prettier --write /path/to/index.html
Then Webmin refreshes the file listing/editor.
First, verify Prettier
On the Webmin server:
which prettier
prettier --version
If installed with npm:
Webmin integration
The important point is that this should be implemented as a File Manager extension/action, not by modifying the CodeMirror editor.
I can give you the exact Webmin files and code to add:
/usr/share/webmin/filemin/
with:
Format HTML with Prettier
only appearing when the selected filename ends in:
and executing Prettier against the actual server-side file.
If you want, I can also make it support HTML + CSS + JavaScript:
.html → prettier
.css → prettier
.js → prettier
.json → prettier
while leaving every existing Webmin File Manager function unchanged.