Format CJK (Chinese, Japanese, Korean) and English mixed text with proper typography rules. Includes word counter for markdown files and custom rule support.
Commands:
Cmd/Ctrl+Shift+F- Format Document- Command Palette →
CJK: Format Selection
Word Count (markdown only):
- Shows in status bar automatically
- Includes CJK characters + English words + numbers
- Displays selection count when text is selected
| Feature | Example |
|---|---|
| CJK-English Spacing | 中文English → 中文 English |
| Punctuation Width | 中文,text → 中文,text |
| Quote Spacing | 中文"text" → 中文 "text" |
| Em-dash | 中文--English → 中文 —— English |
| Ellipsis | . . . → ... |
| Parentheses | 中文(text) → 中文(text) |
| Fullwidth → Halfwidth | ABC123 → ABC123 |
| Currency | $ 100 → $100 |
| Slashes | A / B → A/B |
- CJK: Each character = 1 word
- English: Space-separated words (includes numbers)
- Smart: Strips markdown formatting (code blocks, headings, etc.)
- Display: Status bar shows
Words: 1,234or detailed breakdown - Selection: Shows count for selected text
Add your own regex patterns via IntelliSense or settings:
{
"cjkFormatter.customRules": [
{
"name": "right_arrow",
"pattern": "\\s*->\\s*",
"replacement": " → "
}
]
}Built-in examples (press Ctrl+Space in settings):
- Unicode arrows (→, ←, ↔)
- Multiplication sign (×)
- Fractions (½, ⅓, ¼)
- Temperature symbols (°C, °F)
Default: markdown, plaintext, restructuredtext
{
"cjkFormatter.supportedLanguages": ["markdown", "plaintext", "restructuredtext"]
}Add html, latex, or asciidoc if needed. Status bar and format-on-save only work for selected types.
{
"cjkFormatter.wordCount.enabled": true,
"cjkFormatter.wordCount.format": "total" // or "detailed"
}{
"cjkFormatter.formatOnSave": true
}All 13 formatting rules can be enabled/disabled:
{
"cjkFormatter.rules.cjkEnglishSpacing": true,
"cjkFormatter.rules.fullwidthPunctuation": true,
"cjkFormatter.rules.quoteSpacing": true,
// ... see Settings UI for full list
}Before: 这是中文English混合text,价格$ 100
After: 这是中文 English 混合 text,价格 $100
Before: 日本語Englishの混合textです
After: 日本語 English の混合 text です
Before: 한국어English혼합text입니다
After: 한국어 English 혼합 text 입니다
Install from VS Code Marketplace
Or: Extensions → Search "CJK Text Formatter" → Install
Ported from cjk-text-formatter by Xiaolai Li.
MIT