Missing whitespace formatting for pre elements in ePub documents

Latest response

The ePub version of documentation doesn't contain any whitespace formatting for pre elements, which by default don't apply any line wrapping. This results in code snippets overflow out of the screen on a ebook reader. The only way to display full snippet is to decrease font size and change page orientation to landscape.

To remedy this a single rule needs to be added to epub.css file to apply wrapping:

pre {
  white-space: pre-wrap;
}

The XSLT used to produce the ePub version of docs needs to be adjusted to incorporate that formatting.

Responses

Thank you Grzegorz for raising this. I did some tests on OpenShift docs and see no issues with code samples flowing out of the screen. Can you please point to the documentation where you are seeing this issue? This will help us identifying and then correcting it.

I faced that on OSP11 docs, e.g. Networking Guide. However, I can see the same in OCP3.7 Installation and Configuration.

Actual rendering depends largely on the eBook reader application capabilities. Not all have a default CSS rule set for most HTML elements, and in such case the formatting is falling back to defaults. For pre it's to preserve whitespace. For an example, check the viewer app in the Calibre, and you'll see long code lines overflowing.

BTW, I found another formatting issue with images, which I fixed with:

img {
  max-width: 95%;
  margin: 0 auto;
  padding: 0;
}
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.