Warning: This project is no longer maintained. Have a look at its successor: https://github.com/mnater/Hyphenopoly.
- can be included by the creator of the website.
- can be used as bookmarklet on any website.
- is unobtrusive.
- steps behind CSS 3 hyphenation if supported (how to use Hyphenator_Loader).
- 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.
- is highly configurable and has a well-documented API.
- relies on Franklin M. Liangs hyphenation algorithm (PDF) commonly known from LaTeX and OpenOffice.
- supports a large set of different languages.
- provides services for customizing, merging and packing script and patterns.
- also wraps URLs and Email adresses.
- is free software licensed under MIT License (Version 5.0.0 and above).
- Download the recent version of Hyphenator.js
- Use mergeAndPack.html to configure and minify Hyphenator.js and hyphenation patterns.
- Prepare your .html documents (i.e. add
langand add Hyphenator.js)
- Test it!
As with most things, there's a downside, too. Consider the following drawbacks before using Hyphenator.js:
- Hyphenator.js and the hyphenation patterns are quite large. Good compression and caching is vital.
- Automatic hyphenation can not be perfect: it may lead to misleading hyphenation like leg-ends (depends on the pattern quality)
- There's no support for special (aka non-standard) hyphenation (e.g. omaatje->oma-tje)
This beauty becomes manifest in content and representation. I'm firmly convinced that all written text (well, most of it) deserves fine typography, that we deserve it. While hyphenation is just one of many tesserae that forms the appearance of text, it may be an important one.
In code there is readability, maintainability, performance and genius – and some constraints of technology. As a hobbyist programmer I often feel like a hobbit surrounded by wizards who campaign for these values. But being an agile hobbit gives me the freedom to find my own way through the woods (thankfully free from evil in this area). I'm constantly in search of the most performant path to circumvent the constraints of technology while maintaining readability and maintainability of my code. Sometimes this path is illuminated by a wizard1.
If you have a special use case and Hyphenator.js doesn't provide a solution, feel free to submit a feature request.
And please, be patient. Hyphenator.js is a hobby of mine and sometimes other things have precedence…
(1) Some of my coding wizards are: