Automatically hyphenates text

This is a jQuery plugin integrating Hyphenator.js by Mathias Nater.

Hyphenator.js ...

  • automatically hyphenates texts on websites
  • 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).

Supported languages are:

  • Armenian (thanks to Sahak Petrosyan)
  • Belarusian (thanks to Olexandr Zhydenko)
  • Czech (thanks to Martin Hasoň)
  • Danish (thanks to Henrik Ryom)
  • Dutch (thanks to Remco Bloemen)
  • English
  • Finnish (thanks to Olli Wilkman)
  • French
  • German
  • Greek, monoton, polyton and ancient (thanks to Pablo Rodr\xEDguez)
  • Hungarian (thanks to P\xE9ter Nagy)
  • Italian (thanks to Stefano Gorini)
  • Latin (thanks to Pablo Rodr\xEDguez)
  • Latvian (coming soon, thanks to Kristaps Karlsons)
  • Lithuanian (thanks to Rogutės Sparnuotos)
  • Malayalam, Tamil, Hindi, Oriya, Kannda, Telugu, Bengali, Gujarati and Panjabi (thanks to Santhosh Thottingal)
  • Norwegian (coming soon, thanks to Erik Erik Seierstad)
  • Polish (thanks to Kamil)
  • Portuguese (thanks to Lailson Bandeira)
  • Russian (thanks to Dmitry Vedernikov)
  • Slovakian (thanks to Zdenko Podobny)
  • Slovenian (thanks to Mojca Miklavec)
  • Spanish (thanks to Luis Pab\xF3n)
  • Swedish (thanks to Andreas Johansson)
  • Turkish (thanks to Andreas Lappe)
  • Ukrainian (thanks to Alexey Grekov)

A custom jQuery adapter makes sure text loaded asynchronously is processed later on.

The default language is derived reading the language information of the html page as generated by your foswiki language settings. Further more, specific parts of a page can be processed using different langugage patterns using an iso-639-1 language tag, e.g.

<div lang="en-gb">
This part is processed using the british hyphenation patterns.

For further information see http://code.google.com/p/hyphenator/


To load the hyphenator into the current page use


Then add the .hyphenate class name to those html elements that contain text to be hyphenated. Use .donthyphenate to exclude areas from being processed. The language used for processing the text is extracted from the html language settings.

<div class="hyphenate" style="text-align:justify">
This text is processed by Hyphenator.js

  <div class="donthyphenate">
    This text is _excluded_ from hyphenation


This text is _not_ processed.

<div class="hyphenate">
This text is processed as well.

<div class="hyphenate" lang="de">
Dieser Text wird mit deutscher Silbentrennung verarbeitet.

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.


Author(s): Michael Daum
Copyright: © 2011 Mathias Nater http://code.google.com/p/hyphenator/ (Hyphenator.js)
© 2011 Michael Daum http://michaeldaumconsulting.com (foswiki integration)
License: GNU Lesser General Public License
Release: 2.01
Version: 12289 (2011-08-09)
Change History:  
09 Aug 2011: (2.00) upgraded to Hyphenator-4.0.0
10 Jun 2011: (1.01) recognize language tags using underscores as well as hyphens
06 Jun 2011: (1.0) initial release of foswiki plugin
Home page: Foswiki:Extensions/HyphenatorContrib
Support: Foswiki:Support/HyphenatorContrib
Topic revision: r1 - 06 Oct 2017, UnknownUser
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback