The wp-Hyphenate plugin has merged with the wp-Typogrify plugin to form wp-Typography. Try it out, and give us your feedback. The below content is left for legacy, but this plugin is now officially discontinued.
Hyphenation is finally available for the web. The addition of hyphenation is a significant step forward for the state of web typography. With it your left aligned text will be less ragged, and your justified text will avoid the ghastly word spacing that has prevented serious web designers from using it.
wp-Hyphenate includes tremendous ability to customize its application of hyphenation and adds features aid browsers to properly wrap long urls and keep widows company (a widow is the last word of a block of text that stands alone on the last line).
FAQs
- Why hyphenate?
- Hyphenation increases the visual appeal of your website. When justifying text without hyphenation, word spacing is distractingly large. With left-aligned text, the right edge will be unnecessarily ragged.
- How does hyphenation work?
-
The soft-hyphen is an invisible character that communicates to web browsers allowable line breaks within words. When a web browser wraps a line at a soft-hyphen, a hyphen is shown at line’s end.
Similar to the soft-hyphen, the zero-space character communicates allowable line breaks within strings of text. But unlike the soft-hyphen, it does not show a hyphen at line’s end. This is ideal for forcing consistent wrapping of long URLs. It also can be used to force line breaks in uncooperative web browsers after hard-hyphens in words like “zero-space” and “soft-hyphen”.
- Which browsers support hyphenation?
-
Not all browsers support online hyphenation. Notably, before version 3, Firefox did not support hyphenation. Fortunately, it failed gracefully — hyphenated text displayed as if it was unhyphenated.
That is more than could be said for early versions of Safari (1.2 and earlier). Those versions of Safari displayed a hyphen at every possible hyphenation point — even if it was not at line’s end. wp-Hyphenate includes an option to strip all hyphenation from early version of Safari using JavaScript.
Starting with Internet Explorer 6, Firefox 3, Safari 2, and Opera 8, all major web browsers have offered full support for online hyphenation.
- Does hyphenation effect search?
- It depends on the search engine. Google and Yahoo properly handle the soft-hyphen character without penalty. Microsoft and Ask improperly treat soft-hyphens as word breaks. Fortunately, Google and Yahoo comprise more than 90% of the search market.
- Can I control how a specific word is hyphenated?
- Yes. The administrative panel for wp-Hyphenate includes an editable exceptions list.
- What are widows and why protect them?
-
A widow is the final word in a block of text that falls to its own line. Especially if the widow is only a few characters long, she can get lonely. wp-Hyphenate will try to protect widows by bringing them company from the previous line.
There is danger that the widow’s company will leave the previous line with less than optimal word spacing. The risk is less if your text is left-aligned, but if it is justified, tread carefully. The protection of widows is completely customizable in the administrative options.
- Is there any other implementation of this HTML hyphenation technology?
- Yes. KINGdesk has also implemented this same technology as a simple web app at http://hyph-n.com. Submit your static HTML in the provided web form, and it will return hyphenated results for your use.
- Does wp-Hyphenate work with the Typogrify plugin?
- Yes. However, they will both try to prevent widows. Widow handling should be turned off in the Typogrify administrative options. The wp-Hyphenate handling of widows allows for more granular control, allowing the user to balance widow handling with the additional word-spacing created on the previous line.
- What hyphenation algorithm is used in wp-Hyphenate?
- The hyphenation algorithm used by wp-Hyphenate is based on the 1983 Stanford Ph.D. thesis of professor Frank Liang: Word Hy-phen-a-tion by Com-puter. Liang’s PatGen algorithm was updated in 1991 by Peter Breitenlohner. The resulting algorithm finds 90% of all allowed hyphenation points identified in the Webster’s Unabridged Dictionary with a 0% error rate.
- What language patterns are included with this library?
- wp-Hyphenate now has multi-language support. Pattern libraries are included for Basque, Bulgarian, Catalan, Chinese, Pinyin (Latin), Croatian, Czech, Danish, English (United Kingdom), English (United States), Estonian, Finnish, French, Galician, German, Greek (Ancient), Greek, Modern Monotonic, Greek, Modern Polytonic, Icelandic, Indonesian, Interlingua, Irish, Italian, Latin, Lithuanian, Mongolian (Cyrillic), Polish, Portuguese, Romanian, Russian, Sanskrit, Serbian (Cyrillic), Serbocroatian (Cyrillic), Serbocroatian (Latin), Slovak, Slovenian, Spanish, Swedish, Turkish, Ukrainian, and Welsh.
- Can I port this plugin to another CMS?
- Yes. wp-Hyphenate is licensed under the GNU General Public License 2.0. If modify it, you must retain the KINGdesk, LLC copyright information, the request for a link to http://kingdesk.com, and the web design services contact information unchanged. If you redistribute this software, or any derivative, it must be released under the GNU General Public License 2.0.
- Will this plugin slow my page loading times?
- Yes. There is a fair amount of processing that takes place every time a post is called from your MySQL database. In our internal tests, we have seen one-half a second added to single post pages, and over 1 second added to multi-post pages. While page load times will likely remain acceptable to your users, it is still recommended that you use a caching plugin (like WP-Cache or WP Super Cache) with wp-Hyphenate. There is no delay in the serving of cached pages.
- Can I make a donation to support this plugin?
- No. We don’t want your money. If you want to show your support, we would greatly appreciate a link to kingdesk.com from your website — perhaps in a nice review of this plugin.
- This site is damn sexy. Can I hire KINGdesk to design a website for my company?
- Yes. Please contact us.
Version History
- Version 1.07 beta, November 25, 2008
- Worked around last multibyte string function from English hyphenation to address obscure encoding error
- Version 1.06 beta, November 25, 2008
- Provided for single byte alphabets to not use multibyte string functions to increase performance
- Now runs 43% faster for English hyphenation
- Internationalized text in admin options
- Properly removes multiple links that may have been improperly included by the URL linking functionality
- Simplified dehyphen.js to only remove zero-width spaces from IE6
- Version 1.05 beta, November 10, 2008
- Inserted actual soft-hyphen and zero-width space characters, rather than their HTML representations. This cleans up the appearance of the source code.
- Removed errant auto-linking of URLs in the HTML title attribute
- Excluded hyphenation, URL wrapping and widow protection from feeds
- Corrected error to allow zero-width spaces to be stripped from IE6 via JavaScript
- Forced wrapping after underscore characters in the midst of words
- Corrected hyphenation of words containing select non-Latin characters
- Version 1.04 beta, November 16, 2008
- Shortened the default string length for the hyph_chunkSubject function from 4000 characters to 3000. This cured an issue where some text was being dropped (depending on server configuration).
- Unlinked urls now link automatically when the “Always Link URLs” option is selected in the Admin options.
- Version 1.03 beta, November 9, 2008
- General code clean-up to separate core functionality for easy porting to php based content management systems
- Added simple validation for user defined list of tags whose content should not be hyphenated
- Updated all calculations to properly handle multibyte characters as required for multi-language
- Added multi-language support and hyphenation patterns for the following languages: Basque, Bulgarian, Catalan, Chinese, Pinyin (Latin), Croatian, Czech, Danish, English (United Kingdom), English (United States), Estonian, Finnish, French, Galician, German, Greek (Ancient), Greek, Modern Monotonic, Greek, Modern Polytonic, Icelandic, Indonesian, Interlingua, Irish, Italian, Latin, Lithuanian, Mongolian (Cyrillic), Polish, Portuguese, Romanian, Russian, Sanskrit, Serbian (Cyrillic), Serbocroatian (Cyrillic), Serbocroatian (Latin), Slovak, Slovenian, Spanish, Swedish, Turkish, Ukrainian, and Welsh.
- Multi-language support now requires the server run PHP 5. This plugin is not PHP 4 compatable.
- Version 1.02 beta, November 5, 2008
- Resolved problem where occasional character was dropped in long posts.
- Version 1.01 beta, November 4, 2008
- Removed all new PHP 5 functions and replaced with code that is compatible with PHP version 4.3 and later .
- Version 1.0 beta, November 1, 2008
- Original Release
Your feedback is much appreciated. How can we make this plugin better?



John • 3:33 am on Nov. 3, 2008
Sounds like it’ll be a neat plugin. I’m getting a Fatal error in wp-hyphenate.php on line 53 at the moment though
Morgante Pell • 5:12 pm on Nov. 3, 2008
What license do you have this under?
I would love to port it to Habari, under an Open Source license (preferably Apache Software License).
Jeffrey D. King • 5:38 pm on Nov. 3, 2008
@John #0
I am unable to recreate your error. Did you change any of the default preferences in the admin settings?
Jeffrey D. King • 5:44 pm on Nov. 3, 2008
@Morgante #1
I’d love to see this hyphenation solution ported to other platforms.
The plugin is licensed under the GNU General Public License 2.0. If modify the plugin, you must retain the KINGdesk, LLC copyright information, the request for a link to http://kingdesk.com, and the web design services contact information unchanged. If you redistribute this software, or any derivative, it must be released under the GNU General Public License 2.0.
Ricky Irvine • 8:23 pm on Nov. 3, 2008
It’d be nice to know how this works (or doesn’t work) alongside the Typogrify plugin.
Jeffrey D. King • 8:33 pm on Nov. 3, 2008
@Ricky #4
The only point of conflict is the widow handling. If you are pleased with typogrify’s handling of widows, dewidowing can be disabled in wp-hyphenate. wp-hyphenate’s control of widows is a little more granular than typogrify’s. Typogrify just slaps a non-breaking-space before the last word of a paragraph. With wp-hyphenate, you can specify that the non-breaking-space should only be added if the preceding word (or hyphenated portion of a word) is X characters or less. It also allows you to set the maximum size of widows that should be protected from their loneliness. With this additional control, you no longer have to choose between protecting widows and improving rag. You can define your preferred balance. If you prefer the wp-hyphenate handling of widows, the typogrify widow handling can also be disabled (without losing the remainder benefits of that plugin).
wp-Hyphenate does not include the curly quote or em-dash replacement features of typogrify.
Mexside • 11:05 pm on Nov. 3, 2008
Very nice plugin!!!, I will put a review in my blog.
Jeffrey D. King • 1:21 am on Nov. 4, 2008
@Mexside #6
Thank you. I notice that your blog is not English language. Regretfully, only English hyphenation patterns are currently included. If there is demand and PatGen libraries exist, other languages may be included in future revisions.
Jeffrey D. King • 3:38 am on Nov. 4, 2008
@John #0
I have apparently used some functions that are new to php5. If you are using php4, you will get the error you mentioned. I will look to update the plugin to be backwards compatible to php4.
Jeffrey D. King • 4:17 am on Nov. 4, 2008
@John #0
The plugin is now php4 compatible.
Derek • 9:24 am on Nov. 5, 2008
Great plugin. I know it is still beta so I figured I would report a little bug I noticed. With the plugin enabled, I was seeing unordered lists not being closed properly.
Jeffrey D. King • 9:49 pm on Nov. 5, 2008
@Derek #10
On long posts, approximately every 4000th character was being dropped. The issue has been resolved in version 1.02 beta. Thanks for your assistance in recreating this issue.
Ryan • 5:25 am on Nov. 11, 2008
Once this is activated where should I find the admin page? It’s not appearing under settings.
Ryan • 5:42 am on Nov. 11, 2008
Ah, found it in the plugins menu… confused because most other plugins have the admin page in the settings. Personally I prefer the admin to stay in plugins!
bluemonkey • 1:58 am on Nov. 16, 2008
I’d like to create a language pattern file for Hungarian.
Is there a conversion utility that takes those hyph*.tex files and generates the proper php equivalent?
Or at least could you point me to some kind of ‘how to…’ doc?
Great thanks!
Jeffrey D. King • 1:44 pm on Nov. 16, 2008
@bluemonkey #14
I have the raw Hungarian pattern. It needs to be formatted to optimize performance. The reason I did not include it with the current language patterns is that the Hungarian patterns exceed 65,000 in quantity. To put this in scale, the US English patterns are fewer than 5,000. This will greatly impact performance.
If you want to spend the time to format it, I will email you the patterns and share with you the tool I created to expedite the process.
FYI, this is the same reason I have not released Norwegian patterns (27,000 in quantity)
johno • 12:37 pm on Nov. 19, 2008
I’m using it, and, thus far, I’m impressed.
PP • 5:06 am on Nov. 20, 2008
Hi! Thank you for a great plugin.
There is a problem in Polish hyphenation: the “i” character is left at the end of the line.
IT IS:
Całość zachowań związanych i
zależnych od…
IT SHOULD BE:
Całość zachowań związanych
i zależnych od…
Is there a way to fix it?
PP • 5:07 am on Nov. 20, 2008
The same goes for “od”, “do” and a number of other “stop” words.
Jeffrey D. King • 7:37 am on Nov. 20, 2008
@PP #17 & #18
Wrapping behavior of individual words is outside the scope of this plugin (excepting widows). The hyphenation functionality only looks at allowable wrapping patterns within words.
You can manually add non-breaking spaces before words you do not want at lines end. To add a non-breaking space, type in place of the relevant space.
PP • 9:32 am on Nov. 20, 2008
That answers it. Thank you!
Bobby • 2:53 pm on Nov. 21, 2008
Hi, this looks like a great plugin, but when I installed v1.05 I got the following fatal error:
Fatal error: Call to undefined function: mb_strtolower() in /home/…/wordpress/wp-content/plugins/wp-hyphenate/hyphenate.php on line 110
Can you suggest any remedy? Thanks.
Jeffrey D. King • 3:00 pm on Nov. 21, 2008
@Bobby #21
This plugin requires PHP 4.3 or later. You will need to ask your web host or network administrator to update the version of PHP running on your server.
Antonio • 2:14 pm on Nov. 28, 2008
Jeffery, my server is running PHP 4.4.8 and PHP 5.2.6 and I’m still getting the same fatal error as Bobby. Any ideas?
Antonio • 11:06 am on Dec. 8, 2008
Jeff, any help would be very appreciate. Thanks!
kristarella • 2:59 am on Dec. 10, 2008
Great idea, definitely a big step in the right direction.
Sadly, found a bug. Enabling hyphenation breaks WordPress captions. At least on my test blog, using MAMP with Apache 2.0.59 and PHP 5.2.5, on WordPress 2.7 RC1. I have no idea if it’s a WordPress bug and not your plugin, so sorry if it’s the former.
I took screenshots with the enable hyphentation option turned on and off.
Jeffrey D. King • 7:26 pm on Dec. 13, 2008
@Antonio #23
mb_strtolower was defined in PHP 4.3.0. If you are getting this error, then you are running an earlier version of PHP, or PHP is not fully installed on your web server. I would check with your web host.
Because of some other issues that have arisen, I recommend running this plugin on PHP5.
Jeffrey D. King • 7:27 pm on Dec. 13, 2008
@kristarela #25
Thanks for reporting this bug, I will look into it and include a fix in the next update.
Antonio • 7:39 pm on Jan. 8, 2009
Jeffrey, I actually checked again and the error is different from the one above. Here is what I’m getting right after activating it.
Warning: cannot yet handle MBCS in html_entity_decode()! in /nfs/c03/h03/mnt/55393/domains/thegridsystem.org/html/wp-content/plugins/wp-hyphenate/hyphenate.php on line 32
Any ideas?
C.N. • 12:58 pm on Jan. 12, 2009
Yes, I’m getting the same “cannot yet handle MBCS … line 32″ error as well. I’m running WP 2.7.
Jeffrey D. King • 9:21 pm on Jan. 12, 2009
@Antonio # 28 & C.N. #29
This has been successfully cured by other users by upgrading their domain to PHP5. Please note many hosts allow different versions of PHP to be installed for domains on the same server. Verifying PHP5 for one domain does not ensure a server-wide condition.
This issue is one where the plugin was upgraded to handle non-latin characters for internationalization (about 50% of the users are outside the US). This required PHP5 functionality.
If there is something else that is causing this same problem, I am unaware of it.
n0s0ap • 1:54 pm on Jan. 19, 2009
This is a great plugin but I ran into one problem right from the get go. Since it hyphenates based on language then words that are not in the dictionary or in a different language don’t get hyphenated. I’d like to think that everyone will use correctly spelled words found in the hyphenation dictionary but somehow I seriously doubt it. Any way to fix this?
Francis • 1:20 am on Mar. 12, 2009
Hi, I have pbs with your plugin. When I try to user other plugins that use shortcodes, they do not work. The only way to make them work is to deactivate your plugin… Just to let you know ! ;-)
Reinis I. • 2:00 pm on Apr. 13, 2009
Enabling wp-Hyphenate prevents captions from working for me: the unparsed [caption] code is displayed instead of the caption. I’m using WP 2.7.1. This is probably a conflict caused by an another plugin, right?
Jeffrey D. King • 3:11 pm on Apr. 13, 2009
@Francis #32 & Reinis I. #33
The conflict with image captions and shortcodes is the same issue. There is an easy hack to fix it. In the wp-hyphenate.php file, there are 5 lines of code about half way down that begin with
add_filter(..., 10);. Replace each10with 9999.I am nearing completion of a complete rehash of this plugin, integrating it with the wp-typogrify plugin. The new merged plugin will have this fix addressed. But for now the hack will have to suffice.
Reinis I. • 3:28 am on Apr. 14, 2009
I see, thanks. That fixed it. Now to make it work with my language (Latvian)…
CFK • 2:27 am on Apr. 17, 2009
Hi Jeffrey,
Hi Reinis,
first thx for the very useful plugin.
I solved the caption-problem by adding “caption” (without the quotes) to the exception list on the hyphenate settings.
Maybe, it might be a work-around. But I didn’t notice any side effects so far.
Keep it up. :)
Bye
CFK
Jeffrey D. King • 7:10 am on Apr. 17, 2009
@CFK #36
That is an interesting solution, but it would not solve the issue for other short codes. For now, the only universal solution is that described in #34.
basambora • 5:57 am on Apr. 19, 2009
Hi, nice plugin, I do have a question though:
Would it be possible to parse the post before storing it in the database? This way you don’t generate unnecessary overhead and the plugin won’t affect the page loading times.
Greetings,
basambora
By the way: will Dutch ever be implemented?
Jeffrey D. King • 11:31 am on Apr. 20, 2009
@basambora #38
I have purposefully avoided destructive alteration of data. This is for many reasons. It would break spell check when editing articles. If someone wants to turn off the plugin, articles would remain hyphenated. If there is a bug in my code, thousands of people would be knocking on my door because I just corrupted their entire archive.
It is best practice to avoid destructive change to data, and I plan on continuing that practice with this plugin.
The Dutch language pattern consists of nearly 14,000 patterns. In my early experiments with other languages, such pattern sizes caused unacceptable delay for processing time. I never bothered formatting the Dutch patterns for wp-hyphenate integration. You can look at the original Dutch TeX pattern here. If you want to go to the trouble of formatting this, I would happily include it in the next release.
Reinis I. • 7:00 am on Apr. 26, 2009
I’d like to comment that the current JS part of wp-Hyphenate is much too bloated. It could easily be stripped down to a couple of lines and the external file dropped. I’ve modified mine to use IE’s conditional comments.
basambora • 8:11 am on Apr. 30, 2009
Jeffrey, I see your point regarding the non-destructive changes, this means that the only way to enable the use of large language patters are:
1. using caching, this saves a bit of processing power, but on-the-fly processing is still needed sometimes
2. saving the original content and the parsed seperately, saves the processing power and response times are increased, though it requires a rather big change of your plugin (if possible at all) and it requires over 2 times as much data to be saved.
So I guess I’ll settle with the first option :)
I also had a look at the tex files and their php counterparts, seems to me the conversion can be automated quite well, but I don’t fully understand your format (nor the tex format), i.e. the begin, end and all arrays and also the dots in the tex patters. Could you clarify this for me?
Greetings,
Basambora
erz • 1:35 am on Jun. 29, 2009
Thanks a lot for your work and efforts. Rest assured that I am promoting this plugin among the few developers I know (and hopefully in an upcoming article on Web-Typography as well).
I was wondering how the work on the update is progressing – not so much in terms of a release date, but more in terms of functionality for foreign language users.
The integration with the Typogrify-Plugin might be a boon to some, but a burden to others. Since I use a typographic plugin that is tailormade for German (“typographical improvements” with minor tweaks), I am wondering if the upgrade might prove detrimental to my setup, as I did not find wp-typogrify as fitting for my needs.
All the best,
erz
Jeffrey D. King • 7:44 am on Jun. 29, 2009
@erz #42
There is progress. I have a working draft, but I am refining the code to improve performance. I’m not entirely pleased with it’s current processing requirements.
As far as foreign language support, the combined plugin will support the same languages and the admin interface will once again be internationalized.
Lastly, the admin interface will allow you to disable any feature you do not want to use (including the typogrify features).
erz • 7:53 am on Jun. 30, 2009
@Jeffrey D. King
Great to hear you are making progress. And that you made the functionalities of the plugin optional is just swell. Now I cannot wait to put my hands on your optimized version. Arrgh, the suspense…
Jeffrey D. King • 12:04 am on Jul. 4, 2009
This plugin is discontinued and replaced by the wp-Typography plugin. We learned a lot from this plugin, and wp-Typography is the realization this plugin’s potential. Enjoy!