# CJK Formatter Plugin

**URL:** https://meta.discourse.org/t/cjk-formatter-plugin/316533
**Category:** Plugin
**Created:** [July 16, 2024, 12:21pm UTC](https://meta.discourse.org/t/cjk-formatter-plugin/316533 "2024-07-16T12:21:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![fokx](https://avatars.discourse-cdn.com/v4/letter/f/958977/32.png) [@fokx](https://meta.discourse.org/u/fokx)
#### Post date: [July 16, 2024, 12:21pm UTC](https://meta.discourse.org/t/cjk-formatter-plugin/316533/1 "2024-07-16T12:21:00Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | reformat topic titles and post texts with mixed CJK and Latin characters, support auto space padding and punctuations correction |
| 🛠 | **Repository Link** | [https://github.com/fokx/discourse-cjk-formatter](https://github.com/fokx/discourse-cjk-formatter) |
| 📖 | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |

  

### Features

Writing mixed CJK(Chinese, Japanese, Korean) characters and Latin characters can be a pain because of the special effort to take on the format. This plugin comes in to automatically reformat topic titles and post contents for you, utilizing [autocorrect-rb](https://github.com/huacnlee/autocorrect/tree/main/autocorrect-rb).

Every time a topic/post is created or updated, its content (and title) will get:

- added space between CJK (full width) and Latin (half-width) character
- corrected punctuation adjacent to CJK character into full-width
- corrected punctuation adjacent to Latin character into half-width

### Configuration

After installation, it will work for new posts.

To reformat all historic posts, use `rake`:

```sh
rake cjk:reformat
rake posts:rebake

```

## Disclaimer

Before use, be sure to learn about how the [`autocorrect`](https://github.com/huacnlee/autocorrect) tool will modify your content and backup your data before continue!

## Acknowledgement

- [GitHub - huacnlee/autocorrect: A linter and formatter to help you to improve copywriting, correct spaces, words, and punctuations between CJK (Chinese, Japanese, Korean). · GitHub](https://github.com/huacnlee/autocorrect)
- [GitHub - openSUSE-zh/discourse-cjk-text-spacing: Automatically add reasonable half-width spaces between Latin and CJK characters in topic title and post content for discourse · GitHub](https://github.com/openSUSE-zh/discourse-cjk-text-spacing)
