All Collections
Author Help
Long content in backticks (making a code span) can lead to overflowing text in the right margin. Is there a workaround?
Long content in backticks (making a code span) can lead to overflowing text in the right margin. Is there a workaround?

Code spans have issues with line breaks if they contain long text with no whitespace, like a chained object reference or a long URL...

Leanpub Support avatar
Written by Leanpub Support
Updated over a week ago
Long content in backticks (making a code span) can lead to overflowing text in the right margin. Is there a workaround?

Long content in backticks (e.g. Object.prototype.hasOwnProperty) can lead to text overflowing into the right margin.

This is a nasty bug that pops up on rare occasions when a long code span containing no whitespace appears near the end of a line. We currently are not sure of how to fix it.

In terms of workarounds, there's a straightforward one: add a line break (not new paragraph) first.

The way you do this varies based on the Markdown dialect you are using to write your book.

If you are using Leanpub Flavoured Markdown, which is currently the default, here's what you do:

At the end of a line, add two spaces, then a single newline.

If you are using Markua, here's what you do:

At the end of a line, add a single newline.

By the way, the differences in newline handling in Markua are discussed here:

https://leanpub.com/markua/read#single-newlines 

To see what Markdown dialect you're using, or to change between Leanpub Flavoured Markdown and Markua, go to:

https://leanpub.com/YOURBOOK/edit_manuscript_format


Related Article: My code samples are having a backslash \ added to them on long lines. Help!


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!

Subscribe to our YouTube channel here: https://www.youtube.com/leanpub

Please subscribe to our YouTube channel here: https://www.youtube.com/leanpub

You can also follow Leanpub in lots of other places!

Did this answer your question?