Page 1 of 1
How to prevent line breaks with "codeblock"?
Posted: Thu Aug 13, 2020 9:26 pm
by Carl
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.
Re: How to prevent line breaks with "codeblock"?
Posted: Fri Aug 14, 2020 12:41 pm
by julien_lacour
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
Re: How to prevent line breaks with "codeblock"?
Posted: Fri Aug 14, 2020 9:15 pm
by Carl
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?
Re: How to prevent line breaks with "codeblock"?
Posted: Sun Aug 16, 2020 3:43 am
by chrispitude
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