If you're writing a book on Leanpub that has programming code blocks in it, here is our recommended best practice regarding code highlighting.

First, we recommend you just let our book generators guess at the programming language being used in each of your code blocks. That way you don't have to do any extra work, and everything should just work automatically.

Second, you can set the default language here:

...and let Leanpub guess the rest.

Third, you can set the default language, and also specify the language on every code block that is not using the default language. (Here is the manual if you're writing in Markua, and here is the manual if you're writing in Leanpub-Flavored Markdown.)

This recommendation is in part based on the use case where an author eventually wants to use our Print-Ready PDF export process, to make a print book. If you follow these recommendations, that should make producing a print book a lot easier, in the end.

Someday we may offer specific overrides for the Print-Ready PDF export process, but until then, these guidelines should help save you time and effort.

Did this answer your question?