My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

Hyphenator.js …

  • automatically hyphenates texts on websites if either the webdeveloper has included the script on the website or you use it as a bookmarklet on any site.
  • runs on any modern browser that supports JavaScript and the soft hyphen (­).
  • automatically breaks URLs on any browser that supports the zero width space.
  • runs on the client in order that the HTML source of the website may be served clean and svelte and that it can respond to text resizings by the user.
  • follows the ideas of unobtrusive JavaScript.
  • has a documented API and is highly configurable to meet your needs.
  • supports a wide range of languages.
  • relies on Franklin M. Liangs hyphenation algorithm (PDF) commonly known from LaTeX and OpenOffice.
  • is free software licensed under LGPL v3 with additional permission to distribute non-source (e.g., minimized or compacted) forms of that code (see source code header for details).
  • provides services for customizing, merging and packing script and patterns.
  • supports CSS3-hyphenation

Hyphenator.js does …

  • not give you control over how many hyphens you'll have as endings on consecutive lines.
  • not eliminate misleading hyphenation like 'leg-ends' (depending on the pattern quality).
  • not work in Firefox 2 (but it works fine in Firefox >=3.0)
  • not handle special (aka non-standard) hyphenation (e.g. omaatje->oma-tje)

See a simple life example (resize window or click the button in the upper right corner).

Where to go from here

See the articles in the wiki for more information about:

There's also a FAQ and a large set of test cases.

If you're looking for a server-side script doing hyphenation I recommend http://yellowgreen.de/phphyphenator

If you're looking for a script that does really nice line breaking (using an implementation of the Knuth and Plass line breaking algorithm) see http://www.bramstein.com/projects/typeset/flatland/.

There's a port of Hyphenator.js to ActionScript: http://code.google.com/p/hyphenator-flash/

If you're looking for a more light-weight solution (using Knuth's algorithm from 1977, english only), see http://github.com/aristus/sweet-justice

News

October 11, 2011

CSS3 Hyphenation is coming in IE 10: http://blogs.msdn.com/b/ie/archive/2011/10/10/building-rich-text-centric-pages-in-ie10.aspx

Building on Microsoft’s expertise acquired over years of hyphenating text in Microsoft Office, Internet Explorer 10 supports hyphenation in 18 of the world’s most common languages. These include Catalan, Czech, Danish, Dutch, English, French, German, Italian, Norwegian (Bokmål and Nynorsk), Polish, Portuguese, Brazilian Portuguese, Russian, Spanish, Swedish, and Turkish (as well as common variants for many of those languages—British and American English, for example).

August 18, 2011

New wiki page about CSS3-hyphenation. It's not complete an reviewed, yet…

August 05, 2011

Since Safari on Mac OS X Lion now supports hyphenation for some languages, it is definitely time to roll-out a new Version: Version 4.0.0 This major release brings the following new features:

  • Faster hyphenation algorithm based on a trie (thanks to Bram Stein)
  • Faster DOM traversal
  • Overall: 30% less execution time
  • Support for CSS3-Hyphenation ( issue133 )
  • progressive unhiding of hyphenated elements ( issue123 )
  • Added support for Slovak (thanks to Zdenko Podobny)
And some bugfixes:

Donate

Hyphenator.js is absolutely free of charge. But if you think Hyphenator.js is cool you can

or Donate

Powered by Google Project Hosting