2

I am trying to build an ebook from a programming tutorial (markdown):

it contains many code blocks with comments; the comment lines are too long for the width of my Kobo H2O v2 reader, so I can't read the end...

I tried adding a CSS style for wrapping:

<style>pre code { white-space: pre-wrap !important; }</style>
  • It makes no difference to the Kobo default reader (nickel)...

  • However, the ebook-viewer command from calibre detects it and wraps them (instead of creating an horizontal scroll bar).

  • Also, inside Koreader, all exceeding lines are wrapped, no matter what CSS I add.

How do I make the default Kobo reader automatically wrap pre lines, without changing the source markdown?

Here is a similar unanswered question.

1 Answers1

1

I found the correct CSS to include, which is dependent from the way pandoc produces the html:

<style>pre > code.sourceCode { white-space: pre-wrap !important; }</style>
  • very interesting; by the way it looks like the Amazon supported CSS does NOT include the white-space pre-wrap attribute. https://kdp.amazon.com/en_US/help/topic/GB5GDY7WAJDN9GFK

    Occasionally this Kindle reference is wrong though. I'd be very curious whether it works on Kindle devices or the Kindle app.

    – idiotprogrammer Aug 14 '22 at 16:14