Turning Off All Code Syntax Highlighting
If you want to turn off all syntax highlighting in your book, go to the "Generation Settings" page for your book:
...and set the DEFAULT CODE LANGUAGE to text, and then click the blue "Update Book" button at the bottom.
(By default, Leanpub will guess the programming language of your code, and try to do syntax highlighting. This turns this off globally.)
Selecting Syntax Highlighting on Individual Code Blocks
If you want to override this for a specific code sample only, how you do this varies based on whether you are using Markua or Leanpub-Flavoured Markdown...
Markua
In Markua, you use an attribute list to format code.
Here's how that looks for an inline code sample:
{format: text}
def foo
puts "hello world"
end
Here's how that looks for an external code sample:
{format: text}

Now, if you want syntax highlighting, you can either let us guess, or you can specify the language yourself:
Here's how that looks for an inline code sample:
{format: ruby}
def foo
puts "hello world"
end
Here's how that looks for an external code sample:
{format: ruby}

Leanpub-Flavoured Markdown
If you're writing in Leanpub-Flavoured Markdown, here's how you can make code blocks that are plain, with no syntax highlighting:
https://leanpub.com/lfm/read#leanpub-auto-code
Here's how that looks:
{lang="text"}
def foo
puts "hello world"
end
Questions or Feedback
If you have any questions or feedback for this article, please email the Leanpub Team at hello@leanpub.com.
To learn about amazing new books and authors, subscribe to our YouTube channel here: https://www.youtube.com/leanpub.
If you have any feedback or questions about this article, please email the Leanpub team about it at hello@leanpub.com!
If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!
Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes: http://help.leanpub.com/en/articles/3088382-quick-walkthroughs-for-getting-started-on-a-leanpub-book
Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!
You can also follow Leanpub in lots of other places!