Skip to main content
All CollectionsAuthor Help
How can I remove syntax highlighting from my code blocks?
How can I remove syntax highlighting from my code blocks?
Leanpub Support avatar
Written by Leanpub Support
Updated over 2 years ago

If you want to turn off all syntax highlighting in your book, go to

Author > Books > (your book) > Settings > Generation Settings

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.)

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}
![Hello, World](hello.rb)

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}
![Hello, World](hello.rb)

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
Did this answer your question?