bat-extras
bat-extras copied to clipboard
[prettybat] Add SVG and XML support
SVG may not be too hard to add, since it should be supported with prettier --parser=html already.
XML support has not been mainlined in prettier yet, so that would need a different formatter, like e.g. tidy, but I haven't investigated enough to know what the best or most reasonable available XML formatter is currently. Not sure if that is something you would want to consider.
I don't really want to use prettier for XML formatting until the prettier XML plugin is included by default, but I managed to get SVG support working in 54db67408ea0b8ad12898b72e9cf248838f54780.
Of course, the question is mainly if you want to wait until prettier does officially support XML formatting or if you'd be open to consider a different formatter in the interim. But even so may be better to wait if anyone besides me is interested in that. ;)
SVG formatting works as advertised, thanks!
I would prefer to wait for prettier since it works well as an all-in-one formatter, but I'm also open to adding more formatters.
But... rather than building all of them in, there's a pretty good chance that I'll end up rewriting prettybat to be a bit more modular. Loading support for extra formatters from a place like ${HOME}/.config/prettybat/formatters.d/*.sh would make prettybat more customizable and also avoid having to add clang-format a dependency of prettybat itself.
Making the list of formatters extensible might be nice too, yes. Dependencies shouldn't be a problem though for the provided ones, as they could (and are in the package available in the AUR) be specified as optional, so the user can already pick and choose which formatters they need and want to install - although of course you are printing a warning when a formatter failed because it was missing.