Turning Off Hyphenation for URLs

Need to break long URLs across a lines, but don't want hyphens? The answer may be simpler than you think!

Beth wrote:

Any clever way you can think of to make InDesign recognize URLs so that it knows to never hyphenate them when breaking lines?

Well, we can’t make InDesign recognize URLs specifically, but we can give you a way to turn off hyphenation for a given string of text. Actually, there are a couple of ways.

First, you could apply the No Break style to the text. But that’s rather extreme, as it won’t let that chunk of text break from one line to another at all. That’s not helpful for long URLs, especially.

The second, more compassionate method, is to change the language of the text to [No Language]. After all, a URL isn’t really English (or Spanish or whatever), and you don’t want to spell-check it anyway. So setting it to No Language means that it won’t cause halts when checking your spelling, and InDesign simply stops trying to hyphenate it. Instead, long URLs break at the punctuation, or in the middle of a word if it’s really long.

If you need to specify a logical place for a long URL to break, you can insert a Discretionary Line Break.

By the way, how do you find all the URLs in your document? Well, one way is with GREP (CS3 and later). Keith Gilbert wrote up a nice method for this on his blog. You could, then, use that GREP to apply the no language designation. Or, in CS4, you could use GREP Styles to apply it automatically in the paragraph style.

Bookmark
Please login to bookmark Close

This article was last modified on December 19, 2021

Comments (6)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...