Skip to content

cozmic72/shyphenate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shyphenate

Automatic hyphenation for Shavian text. Inserts soft hyphens (U+00AD) at syllable boundaries using the Maximal Onset Principle.

This approach produces phonetically natural breaks that may seem unfamiliar to readers accustomed to conventional English orthography. For example, "button" hyphenates as 𐑚𐑳-𐑑𐑩𐑯 rather than but-ton, and "silent" as 𐑕𐑲-𐑤𐑩𐑯𐑑 rather than si-lent.

Available as a JavaScript library, CLI tool, and WordPress plugin.

Building

Requires Node.js 12+ and make.

make          # Build library, CLI, and man page
make test     # Run tests
make install  # Install CLI and man page globally
make wordpress-plugin  # Build WordPress plugin zip

Version is automatically determined from git tags.

Usage

Command Line

# From stdin
echo "𐑥𐑰𐑑𐑦𐑙" | shyphenate
# Output: 𐑥𐑰-𐑑𐑦𐑙

# From file
shyphenate document.txt

# With custom minimum word length
shyphenate --min-length 6 document.txt

JavaScript API

const { syllabify, insertShyBreaks } = require('shyphenate');

// Syllabify a word
const syllables = syllabify('𐑥𐑰𐑑𐑦𐑙');
// Returns: ['𐑥𐑰', '𐑑𐑦𐑙']

// Insert soft hyphens in text
const hyphenated = insertShyBreaks('𐑥𐑰𐑑𐑦𐑙 𐑚𐑳𐑑𐑩𐑯');
// Returns: '𐑥𐑰­𐑑𐑦𐑙 𐑚𐑳­𐑑𐑩𐑯' (soft hyphens invisible until line breaks)

// With options
const hyphenated = insertShyBreaks(text, { minLength: 6 });

WordPress Plugin

  1. Build the plugin: make wordpress-plugin
  2. Upload dist/wordpress-plugin/shyphenate.zip to WordPress
  3. Activate the plugin

The plugin automatically hyphenates Shavian text on both the front-end and in the block editor.

Examples

  • silent: 𐑕𐑲­𐑤𐑩𐑯𐑑
  • meeting: 𐑥𐑰­𐑑𐑦𐑙
  • button: 𐑚𐑳­𐑑𐑩𐑯
  • instances: 𐑦𐑯­𐑕𐑑𐑩𐑯­𐑕𐑩𐑟

Author

Jonathan Ross Website: joro.io GitHub: cozmic72

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published