We use LaTeX to take care of this in our PDFs. It does a pretty good job. Yes, it won't be 100% as good as if you paid a typesetter to do it, but there is nothing obviously objectionable.
For example, one of our books (leanpub.com/battingat10) was written by Chick Dubber, a retired typesetter. He noticed some bad hyphenation and we tweaked a few settings to make it look good. Other than that, he had no complaints.
There are lots of book samples that you can get for free from Leanpub. Many are linked to here: http://leanpub.com/bestsellers. Take a look and see what you think.
This is a special case of a preformatted code block.
For preformatted code blocks, there has to be an absolute line length -- otherwise the code just flows off the right side of the page, as <pre> blocks only do line-breaks when they are actually there.
So, what we do is take all pre-formatted code blocks, wrap them if they go over a certain line length and send a warning to the author letting them know that we did this. This is a case where human intervention is required -- we need to show all of the text, but most of the time you'll want to edit where the line breaks manually.
Most of the time automation is good enough, but we try to inform authors when there's something that needs their attention.
This is a case where human intervention is required -- we need to show all of the text, but most of the time you'll want to edit where the line breaks manually.
OK, so an author would know that there were things that should be manually inspected and changed if needed.
For example, one of our books (leanpub.com/battingat10) was written by Chick Dubber, a retired typesetter. He noticed some bad hyphenation and we tweaked a few settings to make it look good. Other than that, he had no complaints.
There are lots of book samples that you can get for free from Leanpub. Many are linked to here: http://leanpub.com/bestsellers. Take a look and see what you think.