fix-markdown
v0.3.7
Published
Fix Markdown emphasis formatting by inserting spaces around markers containing brackets and special characters
Maintainers
Readme
fix-markdown
Fix Markdown emphasis formatting by inserting spaces around markers containing brackets and special characters.
Problem
LLMs often output invalid Markdown emphasis when using Japanese brackets:
僕は**「こんにちは」**と言った。This should be:
僕は **「こんにちは」** と言った。Solution
This utility automatically fixes emphasis formatting by:
- Detecting brackets (
「」『』()【】) and special characters (%!?。、etc.) within emphasis markers - Inserting half-width spaces around the markers
Usage
import { fixMarkdown } from 'fix-markdown';
const input = '僕は**「こんにちは」**と言った。';
const fixed = fixMarkdown(input);
// Output: '僕は **「こんにちは」** と言った。'Supported Emphasis Formats
- Bold:
**text**,__text__ - Italic:
*text*,_text_
Development
Install dependencies:
bun installRun tests:
bun testAll 22 tests pass ✅
