1. CHM to EPUB conversion

    Calibre really is a superb library management and book conversion tool. Recent versions added support for CHM books, a format not currently (and likely ever to be) supported by most eReaders on the market. Since both CHM and EPUB are compressed collections of HTML files, conversion between the two is fairly trivial. The only problem I personally encountered is code blocks, like in the Python documentation, which don’t get wrapped properly and get rendered offscreen. Fixing it is fairly trivial, though. 

    Add the book you want to convert to the list and hit C (or right-click > Convert > Convert Individually). In the Conversion window that shows up under Look and Feel make sure to check off Linearize tables, in case the CHM file uses tables for its layout (blech):

    A screenshot of "Linearize tables" checkbox in Calibre

    Then, in the Extra CSS text area override whitespace wrapping and the font with the following:

    pre, code { white-space: normal; font-family: "Courier New", Courier, monospace; }

    That bit of CSS will get appended to the primary EPUB stylesheet making sure source code gets reflown just like regular text and has a proper font assigned to it. Granted, that will most likely make code blocks less readable, particularly Python code, but it’s better than not seeing them at all.

    2 years ago  /  0 notes  /  Comments

  2. blog comments powered by Disqus