CotEditor
CotEditor copied to clipboard
Is there a function to indent XML text?
Hello,
Thank you for the great work on CotEditor.
I use v3.7.8.
I would like to know if there is a built-in function to automatically indent an XML unformatted text in order to make it readable, as in Notepad++ (only available on Windows), for example. If there is any, I could not find it. I was only able to choose the XML syntax; this adds colour, which is good, but not enough to make the code really and quickly readable. The function I would like to use in CotEditor is the one offered by this website: https://www.freeformatter.com/xml-formatter.html If it does not exist, of course I can go on using this kind of websites, but it would be great if the function already exists in CotEditor or if its development is scheduled.
Regards, A.
The short answer is "no," unfortunately.
Because CotEditor aims to be a simple, and general plain-text editor, I don't prefer to add features only for specific languages, although XML is a relatively fundamental one.
However, you can add your own CotEditor script to fulfill such a purpose. The manual for scripting CotEditor is bundled to the CotEditor application. See the Help menu.
Maybe a better way is to have a feature (button) that will automatically add/remove code indents for all nested items in all languages? Just like how you can turn off and on syntax highlighting?
Yeah, that's can be a future task.
However, the code indentation is actually more complex than syntax highlighting, in which the regular expression is used in CotEditor. Thus, I maybe need to maintain specific code indentation scripts for each language, and I feel it is too much for CotEditor that is currently developed only by me in my spare time.
I closed this issue since there is no plan to implement this.