@streamdown/cjk package corrects Markdown parsing in Chinese, Japanese, and Korean (CJK) text. Without this plugin, certain CJK punctuation and character boundaries can confuse the GFM parser, producing garbled emphasis markers or URLs that swallow trailing punctuation. It integrates with the plugins.cjk field on <Streamdown>.
Installation
Quick start
createCjkPlugin()
Creates aCjkPlugin instance. No configuration options are required or accepted.
CjkPlugin interface
Discriminant for the plugin union type. Always
"cjk".Plugin identifier. Always
"cjk".Remark plugins that must run before
remark-gfm. Contains remark-cjk-friendly, which modifies emphasis parsing so that CJK characters adjacent to * and _ markers are handled correctly.Remark plugins that must run after
remark-gfm. Contains:- An internal
remarkCjkAutolinkBoundaryplugin that splits GFM autolinks at CJK punctuation boundaries (e.g.。,,,!), preventing trailing punctuation from being absorbed into URLs. remark-cjk-friendly-gfm-strikethrough, which corrects strikethrough detection adjacent to CJK characters.
All remark plugins in a flat array (
[...remarkPluginsBefore, ...remarkPluginsAfter]). Provided for backwards compatibility. Prefer remarkPluginsBefore and remarkPluginsAfter when building custom pipeline integrations, as the order relative to remark-gfm is significant.Plugin ordering
Streamdown automatically inserts the CJK plugins in the correct positions:plugins.cjk field.
Autolink boundary characters
The following CJK punctuation characters are treated as URL boundaries:| Character | Description |
|---|---|
。 . | Full stop |
, 、 | Comma / enumeration comma |
? | Question mark |
! | Exclamation mark |
: | Colon |
; | Semicolon |
( ) | Parentheses |
【 】 | Lenticular brackets |
「 」 | Corner brackets |
『 』 | White corner brackets |
〈 〉 | Angle brackets |
《 》 | Double angle brackets |
