Skip to main content

is_cjk

Function is_cjk 

Source
pub fn is_cjk(c: char) -> bool
Expand description

Whether this is a “CJK character” as the CJK-adjacent emphasis policy sees it.

This is a different question from display width. Using one function for both gets two cases wrong — halfwidth katakana (アイウ) has width 1 but is CJK and needs padding, while emoji have width 2 but are not CJK and need no padding.

The rule follows the CJK-friendly amendment to CommonMark — a character is CJK if its East Asian Width is W, F, or H and it is not emoji presentation, or if its script is Hangul. (https://github.com/tats-u/markdown-cjk-friendly)