Actualy I tested https://www.htmlbeautifier.org/ and it seems to do what I asked.
We do this currently to generate the ugly html, then its just a matter of giving this to an inbuilt …
So you are correct, but it is not as difficult as you imply.
It makes me ask what if the $view widget permitted other formatters to be installed, permitting additional values for the $view widgets formats can be specified in the format attribute:
- This would be a hackability request and easier to get into the core, a user/plugin would then provide an additional formatter. In this case pretty HTML.
- See $:/core/modules/widgets/view.js each format is just calling a javascript function such as $tw.utils.htmlEncode
- We would then give the result of this function to the function provided by www.htmlbeautifier.org (I dont know how to do this)