Saturday, April 7, 2012

Tweaking Code Samples in epub

‹prev | My Chain | next›

While mucking with the epub version of Dart for Hipsters, I have noticed that the code formatting leaves a little something to be desired. Sure, I'd like to have syntax highlighting working, but that's a battle for another book, I think.

I track down the CSS to stylesheets/scribe.css in git-scribe. To that, I add a light grey background:
pre, tt {
 font-family:consolas, 'lucida console', 'bitstream vera sans mono',
            'courier new', monospace;
 color: #000;
  background-color: #eee;
}
I am copying the epubs over to the ipad via dropbox, but the subsequent imports into iBook seemingly make no difference. The result when viewed in Calibre includes the correct background. I eventually get this into the iPad by naming the files differently with each copy to dropbox (e.g. book01.epub, book02.epub, etc). I am not quite certain why this was needed or if it was needed each time, but this is one of the joys of working with book formats—the long feedback cycle when developing.

At any rate, the result is something like:


Which is an improvement. I experiment some with different font-weights, but bold feels too heavy:



And font weights like 500 have no effect (just like anywhere else). So I settle for the light grey and call it a night.


Day #349

No comments:

Post a Comment