All Collections
Author Help
Should I use Leanpub's global setting for the default code language in my programming book, or should I set the language on every code block in my book, or should I let Leanpub guess?
Should I use Leanpub's global setting for the default code language in my programming book, or should I set the language on every code block in my book, or should I let Leanpub guess?
Leanpub Support avatar
Written by Leanpub Support
Updated over a week ago

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?