This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including hyphenopoly
with all npm
packages installed. Try it out:
// For RunKit:
// import hyphenopoly from "hyphenopoly";
import hyphenopoly from "../hyphenopoly.module.js";
// For local node:
// import hyphenopoly from "../hyphenopoly.module.js";
const hyphenator = hyphenopoly.config({
"exceptions": {
"en-us": "en-han-ces"
},
"hyphen": "•",
"loader": async (file) => {
const {readFile} = await import("node:fs/promises");
const {dirname} = await import("node:path");
const {fileURLToPath} = await import("node:url");
const cwd = dirname(fileURLToPath(import.meta.url));
return readFile(`${cwd}/../patterns/${file}`);
},
"require": ["de", "en-us"]
});
async function hyphenateEn(text) {
const hyphenateText = await hyphenator.get("en-us");
console.log(hyphenateText(text));
}
async function hyphenateDe(text) {
const hyphenateText = await hyphenator.get("de");
console.log(hyphenateText(text));
}
hyphenateEn("hyphenation enhances justification.");
hyphenateDe("Silbentrennung verbessert den Blocksatz.");
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.