npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hyphenator.js

v5.1.0

Published

Client-side hyphenation of HTML-Documents

Downloads

808

Readme

Hyphenator.js

  • This repository replaces https://code.google.com/p/hyphenator/
  • Demo: http://mnater.github.io/Hyphenator/

Note: Hyphenator.js has somewhat grown old. Have a look at its successor: https://github.com/mnater/Hyphenopoly While there will still be bugfixes for Hyphenator.js, new features will not be added anymore (except new languages).

Overview

Hyphenator.js is a free open source Javascript library that automatically hyphenates text on websites. It comes in handy as a polyfill for legacy browsers that don't support CSS 3 hyphenation at all or for modern browsers that do hyphenation, but do not provide hyphenation dictionaries for a particular language.

Hyphenator.js …

Quick links

Quick guide

  1. Download the recent version of Hyphenator.js
  2. Use mergeAndPack.html to configure and minify Hyphenator.js and hyphenation patterns.
  3. Prepare your .html documents (i.e. add hyphenate-classes, set lang and add Hyphenator.js)
  4. Test it!

Get detailed instructions.

The bad parts

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)
  • There's no way for Javascript to influence the algorithm for laying out text in the browser. Thus we can't control how many hyphens occur on subsequent lines nor can we know which words have actually been hyphenated. Hyphenator.js just hyphenates all of them.

Philosophy

There is text and there is beautiful text

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.

There is code and there is sound code

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.

Issues and Requests

Each release is tested in various browsers with an automated testsuite. Nevertheless, there will always be bugs. Please don't hesitate to submit them.

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: