pangu.js
Opinionated paranoid text spacing in JavaScript
pangu.js is a lightweight JavaScript library that automatically inserts proper spacing between Chinese, Japanese, or Korean (CJK) characters and Latin letters, numbers, or symbols. The goal is typographic polish: mixed-script text often becomes cramped or ambiguous without the correct spacing rules, and pangu.js fixes that reliably. It uses rule-based detection to walk text and add spaces where needed without altering the characters themselves. The library runs in browsers or Node.js, and can process raw strings, DOM nodes, or entire documents. Because it’s idempotent, applying it repeatedly won’t keep adding extra gaps, which makes it safe in pipelines. ...