Your example
import { glue } from "@typehug/en";
const text = "I brought a notebook. We have 30 min to turn a good idea into a first draft.";
const result = glue(text);
Nonbreaking spaces for English and Polish.
DocumentationTry an example or edit the text to see it for yourself.
Compare short words and paragraph endings at different widths.
I brought a notebook. We have 30 min to turn a good idea into a first draft.
I brought a notebook. We have 30 min to turn a good idea into a first draft.
Your text stays in this browser.
6 nonbreaking spaces added
Why Typehug joined each highlighted space.
No changes for this text with the selected rules.
I brought a notebook. We have 30 min to tu…
I brought a notebook. We have 30 min to turn a good …
I brought a notebook. We have 30 min to turn a good idea into a first dra…
…ght a notebook. We have 30 min to turn a good idea into a first draft.
…e have 30 min to turn a good idea into a first draft.
… 30 min to turn a good idea into a first draft.
Characters and protected text already in your input.
No selected invisible characters or protected text found. Ordinary spaces and line breaks are not listed.
The same text, language and rules.
npm install @typehug/enimport { glue } from "@typehug/en";
const text = "I brought a notebook. We have 30 min to turn a good idea into a first draft.";
const result = glue(text);
Install the language you need. Pass in your text.
npm install @typehug/enEnglish rules and the shared engine. No Polish rules included.
import { glue } from "@typehug/en";
glue("I have a question.");
I have a question.
Returns a string with Unicode nonbreaking spaces. Render it as text, including in React.
import { glueHtml } from "@typehug/en/html";
glueHtml("I have a <b>question</b>.");
I have a question.
Joins across inline formatting. Importing /html loads the parser.
import { glueRuns } from "@typehug/en";
glueRuns([
{ text: "I have a " },
{ text: "question.", bold: true },
]);
I have a question.
Preserves formatting metadata and leaves the input objects unchanged.
Examples use English. With @typehug/all, pass { locale: "en" } or { locale: "pl" } as the second argument. HTML is parsed and serialized, so entity spellings and markup may normalize.
English short-word joins and paragraph endings are editorial preferences. Typehug uses text rules, not screen measurements.
Read the rules and sources