zfb
GitHub repository

Type to search...

to open search from anywhere

CJK-friendly emphasis

Core
Created May 28, 2026Updated Jun 7, 2026Takeshi Takatsudo

Ensures bold and italic markers adjacent to CJK ideographs and kana are interpreted correctly.

CjkFriendlyPlugin is always active. It post-processes the parsed markdown AST and re-tokenises emphasis flanking rules for CJK content.

Why this exists

CommonMark's emphasis flanking rules treat CJK ideographs and kana as non-whitespace non-punctuation. This means a ** adjacent to CJK text — such as **テスト。**テスト — is not considered right-flanking by the base parser, and renders as literal stars instead of <strong>.

CjkFriendlyPlugin post-processes the parsed markdown AST and re-tokenises these cases. The result matches the intuitive expectation for Japanese, Chinese, and Korean content sites.

Behaviour

Default: always on. No configuration key required.

Opt-out (rare): set cjkFriendly: false in zfb.config.ts only when you need strict CommonMark output and your content has no CJK emphasis:

zfb.config.ts
import { defineConfig } from "zfb/config";

export default defineConfig({
  markdown: {
    cjkFriendly: false,
  },
});

Scope

This plugin handles **bold** and _italic_ adjacent to CJK characters. GFM strikethrough (~~foo~~) does not need the toggle — markdown-rs's GFM tokeniser handles ~~ delimiter runs independently, so strikethrough works correctly at CJK boundaries in both modes.

See also

Revision History

Takeshi TakatsudoCreated: 2026-05-28T11:01:14+09:00Updated: 2026-06-08T01:22:03+09:00