CotEditor icon indicating copy to clipboard operation
CotEditor copied to clipboard

Is there a function to indent XML text?

Open impala75 opened this issue 4 years ago • 3 comments

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.

impala75 avatar Oct 21 '20 17:10 impala75

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.

1024jp avatar Oct 26 '20 11:10 1024jp

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?

gregarios avatar Oct 26 '20 16:10 gregarios

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.

1024jp avatar Oct 27 '20 00:10 1024jp

I closed this issue since there is no plan to implement this.

1024jp avatar Mar 14 '23 06:03 1024jp