Avoid hard line breaks within tags

<oXygen/> general issues.
BenedekNagyTW
Posts: 2
Joined: Tue Dec 08, 2020 3:22 pm

Avoid hard line breaks within tags

Post by BenedekNagyTW » Tue Dec 08, 2020 3:32 pm

To make reviews on GitHub better, I have turned on Hard line breaks. However, hard line breaks seem to be inserted completely freely (outside of literal-type elements), which results in cases where it breaks a tag or an attribute in two, for example:

Code: Select all

are described in <xref
                        linkend="taskSetDeviceName" />.</para>
While of course this doesn't break the xml, it is really ugly and could raise some exceptions, as custom parsers and search and replace operations might not be prepared for such a case.
I have looked for any possibility in Oxygen Author 22.1 to avoid this, with no success. Of course, I could have a setting to insert a hard line break before every inline element, but that would result in too many line breaks.
Is there actually a way to solve this? Or does it need to be requested as a feature?

adrian
Posts: 2717
Joined: Tue May 17, 2005 4:01 pm

Re: Avoid hard line breaks within tags

Post by adrian » Fri Dec 11, 2020 5:52 pm

Hello,

I'm afraid there is no option to prevent line breaks within tags. Quite the opposite, there is an option to "Break the line before an attribute name" which forces line breaks in tags. So first, check if you have that enabled (Options > Preferences, Editor / Format / XML) and clear it, if that's the case.
Avoiding line breaks within tags is unusual because a line break within a tag is the most convenient way of breaking the line to avoid an excessively long line, while not affecting the XML content. There are also some situations where there is an element with many attributes which would again force a very long line if no line break would be inserted between attributes.
I've logged a feature request to try and accommodate this.

Meanwhile a possible workaround is to set the "Line width" (Options > Preferences, Editor / Format) to a very large size, but this will cause lines to be very long (there will be no line breaks inserted as a general rule).

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

BenedekNagyTW
Posts: 2
Joined: Tue Dec 08, 2020 3:22 pm

Re: Avoid hard line breaks within tags

Post by BenedekNagyTW » Fri Dec 11, 2020 7:00 pm

Hi Adrian,

Thank you for your reply.
I think "affecting the xml content" depends on the use-case. For most users, hard line breaks within the xml content are completely meaningless, as transformations and parsers ignore them.
My goal with allowing hard line wrapping was exactly to avoid long lines, that is why I have set the line width to a lower value. No one wants to scroll horizontally in applications like GitHub where soft wrapping is not available for xml. Of course, this could also be solved if GitHub would allow configuring xml as "prose" to enable soft wraps, but I feel like the mentioned option in Oxygen would make sense anyway.

Best regards,
Benedek

Post Reply