How to prevent line breaks with "codeblock"?

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

How to prevent line breaks with "codeblock"?

Post by Carl » Thu Aug 13, 2020 9:26 pm

How do I prevent a line break within a codeblock paragraph in my PDF?

I was searching for an equivalent to Word's "Keep lines together" option, but I can't find one.

julien_lacour
Posts: 125
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to prevent line breaks with "codeblock"?

Post by julien_lacour » Fri Aug 14, 2020 12:41 pm

Hello,

You should be able to do the trick by using the following CSS selector:

Code: Select all

*[class~='pr-d/codeblock'] {
    page-break-inside:avoid;
}
Regards,
Julien

Carl
Posts: 90
Joined: Fri Oct 19, 2018 2:19 am

Re: How to prevent line breaks with "codeblock"?

Post by Carl » Fri Aug 14, 2020 9:15 pm

Thanks for the info. Now I'm having a difficult time trying to identify which ".css" file to add this code snippet.

Is there a default .css that Oxygen uses for PDF? Or do I need to create a new custom .css for PDF?

chrispitude
Posts: 256
Joined: Thu May 02, 2019 2:32 pm

Re: How to prevent line breaks with "codeblock"?

Post by chrispitude » Sun Aug 16, 2020 3:43 am

Carl wrote:
Fri Aug 14, 2020 9:15 pm
Thanks for the info. Now I'm having a difficult time trying to identify which ".css" file to add this code snippet.

Is there a default .css that Oxygen uses for PDF? Or do I need to create a new custom .css for PDF?
To get started, you can create a my.css file in the root of your project directory with only that property.

If you're using the default "DITA Map PDF - based on HTML5 & CSS" transformation, make a duplicate of it so you can edit the settings.

Now set the args.css parameter to ${pdu}/my.css:

image.png
image.png (43.45 KiB) Viewed 171 times

Post Reply