{"id":13721118,"url":"https://github.com/bramstein/hypher","last_synced_at":"2025-05-16T05:04:14.574Z","repository":{"id":66078433,"uuid":"1422905","full_name":"bramstein/hypher","owner":"bramstein","description":"A fast and small JavaScript hyphenation engine","archived":false,"fork":false,"pushed_at":"2018-07-29T10:22:24.000Z","size":910,"stargazers_count":569,"open_issues_count":5,"forks_count":55,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-05-16T05:04:05.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bramstein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2011-02-28T19:39:25.000Z","updated_at":"2025-04-06T07:28:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"ce24fe94-a7c3-4334-a809-c50b75bbe8f9","html_url":"https://github.com/bramstein/hypher","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramstein%2Fhypher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramstein%2Fhypher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramstein%2Fhypher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bramstein%2Fhypher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bramstein","download_url":"https://codeload.github.com/bramstein/hypher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471061,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:01:12.648Z","updated_at":"2025-05-16T05:04:14.557Z","avatar_url":"https://github.com/bramstein.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Publishing Tools and Platforms"],"sub_categories":[],"readme":"## Hypher\n\nA small and fast JavaScript hyphenation engine. Can be used in Node.js and as a jQuery plugin.\n\n## Node.js\nHypher can be installed from NPM:\n\n    npm install hypher hyphenation.en-us\n\nYou can then use it in your program by creating an instance of `Hypher` and giving it a language object:\n\n    var Hypher = require('hypher'),\n        english = require('hyphenation.en-us'),\n        h = new Hypher(english);\n\n    // returns ['hy', 'phen', 'ation']\n    h.hyphenate('hyphenation');\n\nSee `examples/node/` for a full example on how to use Hypher. The `hyphenate` method does not support hyphenated compound words. These should be split into individual words before being passed to the hyphenation engine and reassembled afterwards by the caller. You can also use the `hyphenateText` method to hyphenate a string of text. The `hyphenateText` method *does* support compound words and returns a string with inserted soft hyphens (`\\u00AD`.)\n\n    // returns 'Hy|phen|ation is use|ful when cen|ter jus|ti|fy|ing a text.' where `|` is a soft hyphen\n    h.hyphenateText('Hyphenation is useful when center justifying a text.');\n\nThe `hyphenateText` method takes an optional second parameter `minLength` which is the minimum length a word should have to be considered for hyphenation (defaults to 4.) Note that an instance of the `Hypher` class should only be created once for each language object.\n\nThe language object should contain:\n\n    {\n      // The minimum number of unhyphenated characters at the left of each word. (required)\n      leftmin: \u003cnumber\u003e, \n\n      // The minimum number of unhyphenated characters at the right of each word. (required)\n      rightmin: \u003cnumber\u003e,\n\n      // A comma separated list of hyphenation exceptions. Custom hyphenations\n      // can be specified using '\\u2027' (hyphenation point) as hyphenation\n      // character. List items are case-insensitive. (Optional)\n      exceptions: \u003cstring\u003e,\n\n      // A patterns object (required)\n      patterns: {}\n    }\n\nLanguage patterns can be found in the [patterns repository](https://github.com/bramstein/hyphenation-patterns).\n\n## jQuery\n\nTo use the jQuery plugin include `dist/jquery.hypher.js` in your HTML document together with any number of language pattern files from the `dist/browser` directory in the [patterns repository](https://github.com/bramstein/hyphenation-patterns). It is important that you include `jquery.hypher.js` before any language pattern files.\n\n    \u003cscript src=\"jquery.hypher.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"en-us.js\"\u003e\u003c/script\u003e\n\nThis will extend jQuery with a `hyphenate` method. Given the following HTML:\n\n    \u003cp\u003eHyphenation is \u003cem\u003eimportant\u003c/em\u003e\u003c/p\u003e\n\nYou can hyphenate the text content of the `p` element like so:\n\n    $('p').hyphenate('en-us');\n\nThe `hyphenate` method only works on the text content of the elements it is called on, so in the above example the word \"important\" will not be hyphenated. To also include the text content of the `em` element, simply include it in your selector:\n\n    $('p, em').hyphenate('en-us');\n\nThis naturally also applies to your own classes:\n\n    $('p.hyphenate, em, a').hyphenate('en-us');\n\nThis will hyphenate only `p` with class `hyphenate` and `em` and `a` elements.\n\n## Ender\n\nAssuming you have [Ender](http://ender.no.de/) installed you can either add Hypher and a hyphenation pattern to your library by using the command line `ender build hypher hyphenation.en-us`, or include them in your dependencies in your `package.json`:\n\n    \"dependencies\": {\n      \"hypher\": \"*\",\n      \"hyphenation.en-us\": \"*\"\n    }\n\nand build your library as usual with `ender build .`. Then---as in jQuery---hyphenate the selected elements:\n\n    $('p').hyphenate('en-us');\n\nThe `examples/ender/` directory contains an example project using Ender and Hypher.\n\n## License\nHypher is licensed under the three clause BSD license (see BSD.txt.)\n\n## See also\n* [Hyphenation patterns for use with Hypher](https://github.com/bramstein/hyphenation-patterns)\n* [Hyphenator.js](http://code.google.com/p/hyphenator/)\n\n## Contributors\n\n* Laurens Meurs - improvements to the exception list\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramstein%2Fhypher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbramstein%2Fhypher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbramstein%2Fhypher/lists"}