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 Answer 1

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>
1
  • very interesting; by the way it looks like the Amazon supported CSS does NOT include the white-space pre-wrap attribute. 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. Aug 14, 2022 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.