Get started with hyphenopoly CDN

MIT licensed

Library: adds hyphens for consistent typography.

Tags:
  • hyphenation
  • html
  • polyfill
  • hyphens
  • hyphen
  • soft
  • hyphenate
  • JavaScript

Stable version

Copied!

How to start using hyphenopoly CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with hyphenopoly CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/hyphenopoly/5.3.0/Hyphenopoly.js"></script>
  <style>
    .hyphenated { white-space: pre-line; }
  </style>
</head>
<body>
  <p class="hyphenated">This-is-an-example-sentence-with-multiple-words-that-need-hyphenation.</p>
  <button onclick="hyphenate()">Hyphenate</button>
  <script>
    function hyphenate() {
      const p = document.querySelector('.hyphenated');
      Hyphenopoly.hyphenate(p.textContent);
      p.textContent = Hyphenopoly.format(p.textContent);
    }
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions