zudo-doc
GitHub repository

Type to search...

to open search from anywhere

CJK Friendly

Created May 28, 2026Updated Aug 14, 2026Takeshi Takatsudo

Improves bold and italic parsing adjacent to CJK (Chinese, Japanese, Korean) characters.

Core feature — always active, no configuration required.

What it does

CJK Friendly governs two post-parse fixups that adapt CommonMark/GFM rules to CJK text:

  1. Emphasis/strong flanking. CommonMark's emphasis-flanking rules treat CJK ideographs and kana as neither whitespace nor punctuation. As a result, **bold** or _italic_ markers placed immediately next to Chinese, Japanese, or Korean characters are parsed as literal asterisks and underscores rather than formatting delimiters. This fixup post-processes the markdown AST and re-tokenizes emphasis rules to account for CJK content, so bold and italic work correctly around ideographs and kana.

  2. Bare-URL autolink boundary. GFM's autolink-literal grammar terminates a bare URL only on ASCII whitespace, so a URL flush against CJK text (詳細はhttps://example.com参照) swallows the trailing CJK run into the href. This fixup terminates the link at the first CJK character instead. It only applies when gfm.autolinkLiteral is also enabled — which it is by default, since zfb 2.5.0 includes autolink literals in the conservative GFM default.

Example

The following renders correctly with emphasis markers adjacent to Japanese text:

これは **重要な** テキストです。
_イタリック_ も正しく機能します。

A bare URL flush against CJK text also terminates at the right boundary (with gfm.autolinkLiteral enabled):

詳細はhttps://example.com参照してください。

Without this fixup, the trailing 参照してください。 would be swallowed into the link's href.

Disabling

In rare cases where strict CommonMark compliance is required, you can turn the feature off in zfb.config.ts:

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

Omitting cjkFriendly (the default) keeps the feature on.

Notes

  • GFM strikethrough (~~text~~) is handled independently by markdown-rs and is unaffected by this setting.

  • The feature operates as an AST post-processor; it does not modify the base parser.

Revision History

Takeshi TakatsudoCreated: 2026-05-29T01:40:39+09:00Updated: 2026-08-14T22:35:11+09:00

AI Assistant

Ask a question about the documentation.

Preview theme

Loading theme previews…