markdown-cjk-fix
Fixes the issue where CJK punctuation marks are not rendered correctly in Markdown bold/italic
修复Markdown粗体/斜体中的CJK标点未能正确渲染的问题
Markdown の太字・斜体で CJK 句読点が正しくレンダリングされない問題を修正
EN English | 🇨🇳 中文 | 🇯🇵 日本語
A lightweight VSCode plugin designed to resolve the issue where CJK punctuation marks are not rendered correctly when used within Markdown emphasis syntax (bold/italic). For more details, see Issue.
此处**强调(标记)**存在问题 -> 此处**强调(标记)**存在问题
This extension injects the markdown-it-cjk-friendly plugin, enabling these CJK punctuation marks to be correctly recognized as part of the emphasized content.
Note
This extension acts solely as a "bridge" or "adapter" to integrate the fixing capabilities of the markdown-it-cjk-friendly project into VSCode's Markdown rendering flow. All logic for handling CJK punctuation marks is provided by the original project: markdown-cjk-friendly by @tats-u.
Many thanks to the original author for their outstanding work! Without markdown-it-cjk-friendly, this extension would be worthless. The sole purpose of this project is to make it easier for VSCode users to utilize this fix.
Disclaimer: The author is not a frontend developer (particularly unfamiliar with TypeScript). This extension was generated with AI assistance.
Installation
Method 1: Install from VSIX file (Recommended)
- Open VSCode and go to the Extensions panel (
Ctrl+Shift+X / Cmd+Shift+X).
- Search with Extension's name:
markdown-cjk-fix.
- Click
install then reload the VSCode window.
Or download the .vsix file from Releases and install it manually via the Extensions panel (··· -> Install from VSIX).
Method 2: Build from Source
- Clone or download this project.
cd markdown-cjk-fix
- Install dependencies:
npm install
- Package the extension:
npx vsce package
- Install the generated
.vsix file (refer to Method 1).
After installation, open any Markdown file and try the following syntax:
此处**强调(标记)**应当正常渲染
In the Markdown preview (Ctrl+Shift+V / Cmd+Shift+V), the punctuation marks should be correctly included within the emphasis style.
Technical Notes
This extension injects the markdown-it-cjk-friendly plugin into the Markdown rendering flow via VSCode's markdown.markdownItPlugins contribution point. The specific implementation is as follows:
import * as vscode from 'vscode';
import markdownItCjkFriendly from 'markdown-it-cjk-friendly';
export function activate(context: vscode.ExtensionContext) {
return {
extendMarkdownIt(md: any) {
return md.use(markdownItCjkFriendly);
}
};
}