cjkspace
Add space between CJK character and western character.
Install
npm install cjkspace --save
Usage
Using tagged template:
const name = 'Kiki' cjkspace`喵喵和赞同了你` // space around Latin character// => '喵喵和 Kiki 赞同了你' cjkspace`()` // no space around punctuation// => '(Black Mirror)' cjkspace`a c` // preserves space, no side-effect// => 'a b c'
Using React component:
const name = 'Kiki' // element and text<CJKSpace> name<strong>赞同了</strong>'Coco'的回答</CJKSpace>// => Kiki <strong>赞同了</strong> Coco 的回答 // custom component, depends on static analysis of children<CJKSpace> <Link>name</Link> 赞同了'Coco'的回答</CJKSpace>// => <a>Kiki</a> 赞同了 Coco 的回答