Transforms plain text or markdown files into well-structured markdown with proper frontmatter, formatting, and typography. Scripts in `scripts/` subdirectory. Replace `${SKILL_DIR}` with this SKILL.md's directory path. Script
Markdown Formatter
Transforms plain text or markdown files into well-structured markdown with proper frontmatter, formatting, and typography.
Script Directory
Scripts in scripts/ subdirectory. Replace ${SKILL_DIR} with this SKILL.md's directory path.
Script
Purpose
scripts/main.ts
Main entry point with CLI options (uses remark-cjk-friendly for CJK emphasis)
scripts/quotes.ts
Replace ASCII quotes with fullwidth quotes
scripts/autocorrect.ts
Add CJK/English spacing via autocorrect
Preferences (EXTEND.md)
Use Bash to check EXTEND.md existence (priority order):
# Check project-level first
test -f .baoyu-skills/baoyu-format-markdown/EXTEND.md && echo "project"
# Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
test -f "$HOME/.baoyu-skills/baoyu-format-markdown/EXTEND.md" && echo "user"
┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ Result │ Action │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Found │ Read, parse, apply settings │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Not found │ Use defaults │ └───────────┴───────────────────────────────────────────────────────────────────────────┘
Add CJK/English mixed text spacing via autocorrect (default: enabled)
Replace ASCII quotes "..." with fullwidth quotes "..." (default: disabled)
Format frontmatter YAML (always enabled)
Step 8: Display Results
LHOST_PH_5
Formatting Example
Before:
This is plain text. First point is efficiency improvement. Second point is cost reduction. Third point is experience optimization. Use npm install to install dependencies.
After:
LHOST_PH_6
Notes
Preserve original writing style and tone
Specify correct language for code blocks (e.g., python, javascript)
Maintain CJK/English spacing standards
Do not add content not present in original
Extension Support
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.