fokx / discourse-cjk-formatter

A Discourse plugin that reformat posts with CJK characters using autocorrect-rb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discourse CJK Formatter Plugin

A Discourse plugin that can reformat topic titles and post texts with mixed CJK and Latin characters and support auto space padding and punctuations correction.

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.

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:

rake cjk:reformat
rake posts:rebake

Disclaimer

Before use, be sure to learn about how the autocorrect tool will modify your content and backup your data before continue!

Acknowledgement

For more information, please see: https://meta.discourse.org/t/cjk-formatter-plugin/316533

About

A Discourse plugin that reformat posts with CJK characters using autocorrect-rb

License:MIT License


Languages

Language:Ruby 92.0%Language:JavaScript 8.0%