Page 1 of 1

Line wraps in code block?

Posted: Tue Mar 03, 2020 1:15 am
by Carl
I have noticed that text within <codeblock> tags do not line wrap in the editor. When compiled as WebHelp, they also do not line wrap unless there is an explicit line break within the code. But this code does wrap when PDF is the output.

My question: It was probably by design that code blocks do not wrap in the editor, to preserve the integrity of the code. But is there a way to "force" these lines to wrap in the editor? I have some topics where a single long line of code causes so much horizontal scrolling that it becomes very cumbersome to edit the topic, and some edits are missed because they occur out of view.

I already have the "Line wrap" option turned on in Options > Preferences > Editor > Edit Modes > Text.

Re: Line wraps in code block?

Posted: Tue Mar 03, 2020 12:34 pm
by Radu
Hi,

The visual Author editing mode is CSS-based so you need to add an extra CSS selector in the CSSs used for editing:

Code: Select all

 *[class~="topic/pre"] {
 white-space:pre-wrap !important;
}
You can find advice here about how to add your own CSS for DITA visual editing:

https://blog.oxygenxml.com/topics/customizeDITACSS.html

Regards,
Radu