Line wraps in code block?

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Posts: 92
Joined: Fri Oct 19, 2018 2:19 am

Line wraps in code block?

Post by Carl » Tue Mar 03, 2020 1:15 am

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.

Posts: 7212
Joined: Fri Jul 09, 2004 5:18 pm

Re: Line wraps in code block?

Post by Radu » Tue Mar 03, 2020 12:34 pm


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:

Radu Coravu
<oXygen/> XML Editor

Post Reply