Back to directory

pangu.js

A JavaScript library, with ports in several other languages, that automatically inserts spacing between Chinese, Japanese or Korean text and adjacent Latin letters, numbers and symbols, plus a browser extension that applies it to web pages.

pangu.js

pangu.js is a text-spacing library that inserts whitespace between CJK (Chinese, Japanese, Korean) characters and adjacent alphabetic letters, numbers and symbols, following the convention of always spacing full-width and half-width characters apart. It ships as an npm package with a browser build that includes DOM-aware helpers for spacing a whole page or a single node.

A companion Chrome extension applies the same spacing rules to any page as you browse, and adds an optional AI Spacing mode that resolves ambiguous symbols, such as a plus sign meaning "and" versus "or more," by asking a small on-device language model that runs fully offline in the browser. The underlying spacing rules are also implemented as ports in Python, Go, Java, Rust, PHP, Ruby, Swift, Clojure, Dart, Elixir and Objective-C.

More in Libraries

See all 292
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • TradeCanvas

    bonguynvan.github.io

    A zero-dependency canvas charting engine for building TradingView-style trading charts in JavaScript, with 66 technical indicators, 24 drawing tools, 17 chart types, and real-time streaming.

  • 3d retro graphics

    3d-retro.com

    A free, CC0-licensed library of copy-paste retro 3D and demoscene graphics effects, such as plasma, raytracing, and voxel terrain, runnable as WebGL 1 or plain 2D canvas.