hyphe-lib-ger

3.0.2 • Public • Published

hyphe-lib-ger.js

npm version Build Status

Add soft-hyphens to German text

CHANGELOG

About

Using the packages hypher and hyphenation.de to parse a normal, German text adding soft-hyphens to allow soft-hyphens in older browsers and Google Chrome.

New: Use typographizer-js to produce better looking typography

Install

In your terminal use

npm i --save hyphe-lib-ger

In your JavaScript file use

const hyphe = require("hyphe-lib-ger");

Usage

hyphe(Text, { Options }).then(text => {
  console.log(text); // Output the formatted text
});

Text: String A String with the text to parse

Options: Object The possible options (not required)

Options

typographize: Boolean (default: false)

  • parse the text with typograhize-js first

ignoreLineBreaks: Boolean (default: false)

  • ignore line breaks completely?

escapeToHTML: Boolean (default: true)

  • escape all non-word characters to their HTML charcode alternative

Example

const hyphe = require("hyphe-lib-ger");
 
hyphe(
  `Lass mich dir kurz vorstellen, was hier eigentlich möglich ist: "Hallo, mein Name ist Daniel"`
).then(res => {
  console.log(res);
});
 
/*
Will return:
Lass mich dir kurz vor­stel­len, was hier ei­gent­lich mög­lich ist: “Hal­lo, mein Na­me ist Da­ni­el”
*/

Example

A working example with this lib and Angular6 is seen here

Readme

Keywords

none

Package Sidebar

Install

npm i hyphe-lib-ger

Weekly Downloads

1

Version

3.0.2

License

MIT

Unpacked Size

102 kB

Total Files

10

Last publish

Collaborators

  • blurrryy