Code librariesReviewed · vinta

pangu.js

pangu.js is a JavaScript library and command-line tool that automatically inserts spaces between Chinese, Japanese or Korean characters and Latin letters, numbers and symbols, for developers who publish mixed-language web pages or plain text. Its README documents AI-assisted spacing only for the companion Chrome extension and warns against using the library on Markdown.

Researched 14 Nov 2026

In short.

pangu.js is a JavaScript library and command-line tool that automatically inserts spaces between CJK (Chinese, Japanese, Korean) characters and Latin letters, numbers and symbols in web pages and plain text, for developers who publish mixed-language content. Its documented AI feature belongs to the Chrome extension and Markdown use is discouraged. The library provides text, file and browser-page APIs, with a command-line interface. The README says the extension uses Chrome’s Prompt API and Gemini Nano locally to interpret ambiguous symbols. Compatibility, accuracy, performance and offline behavior are not independently established; nothing was executed.

Researched and written by an AI model and checked by a second AI model. How it works

The source scope is README.md at [https://github.com/vinta/pangu.js/blob/master/README.md], represented by the captured file at revision 999a58e990adfa7c46ece881d57d4e828f66e06e. The adjacent LICENSE is included as a related notice outside the selected README. Coverage includes the complete supplied README and licence text. Library implementation, extension code, linked pages, sibling projects, prompts, changelog and package artifacts are excluded. Documented outputs, compatibility, performance, AI accuracy and offline behavior were not tested.

The overview

identity

pangu.js is documented in the vinta/pangu.js repository and distributed through the npm package pangu. Its purpose is to insert spacing between CJK characters—Chinese, Japanese and Korean—and Latin letters, numbers and symbols. The source address is [https://github.com/vinta/pangu.js/blob/master/README.md].

The README covers the JavaScript library, a command-line interface and an official Chrome extension. AI Spacing is described under the extension; no LLM-backed JavaScript library API is documented.

assessment

The documented interfaces make pangu.js a practical candidate for websites and plain-text pipelines that repeatedly mix East Asian writing with Latin text. The extension provides a separate route for people who want spacing while browsing.

The contextual AI examples explain a useful distinction between symbols serving different purposes. They do not establish how reliably the extension makes those distinctions across real pages. Accuracy, speed and integration behavior remain unassessed.

users

Web developers can apply spacing to individual strings, a chosen page element or changing page content. Node.js developers can process strings and file content, while command-line users can supply text, files or piped input.

People who want browsing improvements without writing code are directed to the Chrome extension. The library is a poor fit for Markdown processing because the README explicitly advises against that use.

capabilities

The documented library APIs include spaceText() for strings, spaceNode() for a page element, autoSpacePage() for automatic page spacing and spaceFile() for file content. Browser automation uses MutationObserver to respond to changes in the page.

The CLI examples cover direct text, -t text input, -f file input and standard input. A -c example reports a correction and returns exit status 1; other exit conditions are not specified here.

The extension’s AI Spacing examples distinguish an attached plus sign from a joining plus sign, and a negative-number sign from a separator.

Using it

requirements

Library integration requires a JavaScript environment. Page-element operations require a browser document, while the documented file-processing example uses Node.js. Minimum Node.js versions and a browser compatibility matrix are not supplied.

The documented AI path requires Chrome’s built-in Prompt API and Gemini Nano. Supported Chrome versions, operating systems, hardware requirements, model availability and download requirements are unknown from this README.

mechanism

The README contrasts regular-expression spacing rules with contextual interpretation. A symbol such as + or - can require different spacing depending on whether it joins items, belongs to a number or acts as a separator.

For the extension’s AI feature, the README says an LLM handles that contextual distinction through Chrome’s Prompt API, running Gemini Nano on the device. It claims fully offline operation with nothing leaving the machine. The implementation, prompts and network behavior are not available in the supplied files, so those claims remain unverified.

For automatic browser-page spacing, MutationObserver supplies notifications when page content changes, allowing the library to process dynamic content.

setup

The documented installation command is npm install pangu --save-exact. Browser projects should import pangu from 'pangu/browser' for the document-aware build and matching TypeScript types. A self-contained module is available through 'pangu/browser/standalone'; a UMD script is also documented.

In Node.js, the examples use import pangu from 'pangu' or const pangu = require('pangu'). For automatic page processing, the browser example waits for DOMContentLoaded when necessary before calling pangu.autoSpacePage().

The extension installation link is [https://chromewebstore.google.com/detail/paphcfdffjnbcgkokihcdjliihicmbpd]. The README does not supply a separate AI activation procedure or a global-install procedure for exposing the pangu command.

example

A supplied library example calls pangu.spaceText('當你凝視著bug,bug也凝視著你') and shows the result '當你凝視著 bug,bug 也凝視著你'. Spaces separate the Latin word bug from the surrounding Chinese text.

For AI Spacing, the README shows '這裡沒有18+的內容' becoming '這裡沒有 18+ 的內容', keeping the plus sign attached to 18. Its joining example changes '大寫英文字母+9位數字' to '大寫英文字母 + 9 位數字'. These are documentation examples, not observed execution results.

Assessment & evidence

limitations

The README explicitly advises against using pangu.js on Markdown. It describes the library as designed for HTML webpages and plain text without markup.

AI Spacing is documented for the Chrome extension; the text does not establish that npm, Node.js or CLI users receive contextual LLM processing. Although the library describes CJK support, all of the README's examples use Traditional Chinese, so Japanese and Korean handling is not demonstrated.

There are no supplied benchmark results, measured error rates, resource measurements or implementation files. Large-page performance, detailed page-element exclusions, compatibility and the offline privacy claim remain unassessed.

reasoning

The library fits work where a consistent spacing convention should be applied repeatedly to mixed-script text. Its separate string, page-element and page-wide interfaces let developers choose how much content to process.

The rationale for AI is narrower: the same symbol can have different meanings, so one spacing rule may produce the wrong result. The examples make that rationale understandable, but they do not prove that model output will consistently match an editor’s preferences.

alternatives

The README lists official sibling implementations for Python at [https://github.com/vinta/pangu.py], Go at [https://github.com/vinta/pangu] and Java at [https://github.com/vinta/pangu.java]. It also lists a website and HTTP API at [https://github.com/vinta/pangu.space]. These may suit a different runtime or integration approach.

Under user-facing community support, the README also links Paranoid Text Spacing at [https://tools.1chooo.com/paranoid-text-spacing] and 盤古之白 - 文案排版轉換 at [https://pangu.serko.dev/]. The README does not describe them, so their functionality, AI support, privacy, costs and compatibility are unknown.

evidence

The technical evidence is the README snapshot at [https://raw.githubusercontent.com/vinta/pangu.js/999a58e990adfa7c46ece881d57d4e828f66e06e/README.md]. It supplies API examples, installation guidance, extension claims and usage warnings. The accompanying rights evidence is [https://raw.githubusercontent.com/vinta/pangu.js/999a58e990adfa7c46ece881d57d4e828f66e06e/LICENSE].

Implementation code, extension packages, linked documentation, prompt files and evaluation results are absent. The README’s claims about local inference and contextual behavior therefore remain documentation claims. Nothing was installed, executed or tested.

Access & freshness

costs

The README describes the extension’s AI Spacing feature as free. The MIT notice grants permission to use the covered software without a licence fee.

No quantified hardware, storage, download or computation costs are supplied. Charges and terms for linked hosted services are unknown. Total operating cost is not established by the documentation.

rights

The supplied MIT licence names Vinta as the copyright holder and permits use, copying, modification, merging, publication, distribution, sublicensing and sale of the software and associated documentation. Copies or substantial portions must retain the copyright and permission notices.

The licence provides the software without warranty and disclaims liability. It does not establish separate terms for Chrome, Gemini Nano, linked services or third-party ports.

freshness

The captured README is from source revision 999a58e990adfa7c46ece881d57d4e828f66e06e and was captured at 2026-11-14T12:34:54.092Z. The README text itself states no release date or package version.

The supplied text does not establish an exact npm package version or Chrome extension version. Badge links and CDN examples using @latest do not identify a fixed release. Compatibility between a currently installed release and this documented snapshot is unknown.

actions

For application integration, begin with spaceText() on representative plain text and compare the spacing with the intended editorial convention. Use the browser-specific import for page-element operations, and keep Markdown outside this processing path.

For browsing, confirm that the Chrome installation supports the required Prompt API and Gemini Nano before relying on AI Spacing. Check ambiguous symbols and changing page content before adopting automatic page-wide spacing. When integrating a library release, record the chosen version rather than relying on an unpinned @latest URL.

Evidence for this report

LICENSEnotice · checked 2026-11-14
README.mdselected · checked 2026-11-14