# Space Between CJK and Latin

> Adds a space between Chinese or Japanese characters and Latin letters or digits, but not next to punctuation

Version: 1.0.0 · By Deck

- Install in Deck: deck://install-plugin?id=cjk-latin-spacing&url=https%3A%2F%2Fgithub.com%2Fyuzeguitarist%2Fdeck-plugins%2Freleases%2Fdownload%2Fplugins%2Fcjk-latin-spacing-1.0.0.zip
- Download .zip: https://github.com/yuzeguitarist/deck-plugins/releases/download/plugins/cjk-latin-spacing-1.0.0.zip
- View on GitHub: https://github.com/yuzeguitarist/deck-plugins/tree/main/plugins/cjk-latin-spacing

Or install with Terminal: 

```sh
mkdir -p ~/.deck/scripts/cjk-latin-spacing && curl -fsSL https://github.com/yuzeguitarist/deck-plugins/releases/download/plugins/cjk-latin-spacing-1.0.0.zip | tar -xf - -C ~/.deck/scripts/cjk-latin-spacing
```

## Script

```js
// Puts a space between Chinese or Japanese characters and Latin letters or digits where they touch.

// Han ideographs, kana and bopomofo. Hangul is left out: Korean attaches particles directly to Latin words.
const CJK = "\u2e80-\u2fdf\u3005-\u3007\u3040-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3100-\u312f\u31a0-\u31bf\u31f0-\u31ff" +
  "\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\u{20000}-\u{3ffff}";
const LATIN = "0-9A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u024f\u1e00-\u1eff";
const TOUCHING = new RegExp("[" + CJK + "](?=[" + LATIN + "])|[" + LATIN + "](?=[" + CJK + "])", "gu");

function transform(input) {
  return String(input ?? "").replace(TOUCHING, "$& ");
}
```

---

- HTML: https://deckclip.app/plugins/cjk-latin-spacing
- 中文: https://deckclip.app/zh-cn/plugins/cjk-latin-spacing.md

© 2026 Yuze Pan
