{"data":{"slug":"github-anbeime-skill-skills-content-creation-publisher-baoyu-format-markdown-4b78bc34ed9c","title":"Markdown Formatter","summary":"Transforms plain text or markdown files into well-structured markdown with proper frontmatter, formatting, and typography. The script must be run using the specified command after saving the file.","url":"https:\/\/skillshunter.net\/skills\/github-anbeime-skill-skills-content-creation-publisher-baoyu-format-markdown-4b78bc34ed9c","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-anbeime-skill-skills-content-creation-publisher-baoyu-format-markdown-4b78bc34ed9c","markdown_url":"https:\/\/skillshunter.net\/skills\/github-anbeime-skill-skills-content-creation-publisher-baoyu-format-markdown-4b78bc34ed9c.md","download_url":"https:\/\/skillshunter.net\/skills\/github-anbeime-skill-skills-content-creation-publisher-baoyu-format-markdown-4b78bc34ed9c\/download","category":{"slug":"content-editorial","name":"Content & Editorial"},"editor_note":"Before running the script, ensure the formatting script is executed with the correct command: `npx -y bun ${SKILL_DIR}\/scripts\/main.ts {output-file-path} [options]`. The script applies formatting based on the selected options, including CJK\/English spacing, quote replacement, and emphasis fixes.","instructions":"---\nname: baoyu-format-markdown\ndescription: \u6280\u672f\u5199\u4f5c\u5458\u4e0e\u5185\u5bb9\u521b\u4f5c\u8005\u5728\u5904\u7406\u7eaf\u6587\u672c\u6216 Markdown \u7a3f\u4ef6\u65f6\uff0c\u82e5\u9700\u4f18\u5316\u6587\u7ae0\u7ed3\u6784\u3001\u6dfb\u52a0 frontmatter \u6216\u81ea\u52a8\u4fee\u6b63\u4e2d\u82f1\u6587\u6392\u7248\u95f4\u8ddd\uff0c\u4f7f\u7528\u6b64\u6280\u80fd\u53ef\u4e00\u952e\u751f\u6210\u4e13\u4e1a\u7f8e\u89c2\u7684 {filename}-formatted.md \u6587\u4ef6\uff0c\u8ba9\u6587\u6863\u6392\u7248\u66f4\u5b8c\u7f8e\u3002\n---\n\n# Markdown Formatter\n\nTransforms plain text or markdown files into well-structured markdown with proper frontmatter, formatting, and typography.\n\n## Script Directory\n\nScripts in `scripts\/` subdirectory. Replace `${SKILL_DIR}` with this SKILL.md's directory path.\n\n| Script | Purpose |\n|--------|---------|\n| `scripts\/main.ts` | Main entry point with CLI options (uses remark-cjk-friendly for CJK emphasis) |\n| `scripts\/quotes.ts` | Replace ASCII quotes with fullwidth quotes |\n| `scripts\/autocorrect.ts` | Add CJK\/English spacing via autocorrect |\n\n## Preferences (EXTEND.md)\n\nUse Bash to check EXTEND.md existence (priority order):\n\n```bash\n# Check project-level first\ntest -f .baoyu-skills\/baoyu-format-markdown\/EXTEND.md && echo \"project\"\n\n# Then user-level (cross-platform: $HOME works on macOS\/Linux\/WSL)\ntest -f \"$HOME\/.baoyu-skills\/baoyu-format-markdown\/EXTEND.md\" && echo \"user\"\n```\n\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502                           Path                           \u2502     Location      \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 .baoyu-skills\/baoyu-format-markdown\/EXTEND.md            \u2502 Project directory \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 $HOME\/.baoyu-skills\/baoyu-format-markdown\/EXTEND.md      \u2502 User home         \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502  Result   \u2502                                  Action                                   \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 Found     \u2502 Read, parse, apply settings                                               \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 Not found \u2502 Use defaults                                                              \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n**EXTEND.md Supports**: Default formatting options | Summary length preferences\n\n## Usage\n\nClaude performs content analysis and formatting (Steps 1-6), then runs the script for typography fixes (Step 7).\n\n## Workflow\n\n### Step 1: Read Source File\n\nRead the user-specified markdown or plain text file.\n\n### Step 1.5: Detect Content Type & Confirm\n\n**Content Type Detection:**\n\n| Indicator | Classification |\n|-----------|----------------|\n| Has `---` YAML frontmatter | Markdown |\n| Has `#`, `##`, `###` headings | Markdown |\n| Has `**bold**`, `*italic*` | Markdown |\n| Has `- ` or `1. ` lists | Markdown |\n| Has ``` code blocks | Markdown |\n| Has `> ` blockquotes | Markdown |\n| None of above | Plain text |\n\n**Decision Flow:**\n\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502  Content Type   \u2502                     Action                     \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 Plain text      \u2502 Proceed to Step 2 (format to markdown)         \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 Markdown        \u2502 Use AskUserQuestion to confirm optimization    \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n**If Markdown detected, ask user:**\n\n```\nDetected existing markdown formatting. What would you like to do?\n\n1. Optimize formatting (Recommended)\n   - Add\/improve frontmatter, headings, bold, lists\n   - Run typography script (spacing, emphasis fixes)\n   - Output: {filename}-formatted.md\n\n2. Keep original formatting\n   - Preserve existing markdown structure\n   - Run typography script (spacing, emphasis fixes)\n   - Output: {filename}-formatted.md\n\n3. Typography fixes only\n   - Run typography script on original file in-place\n   - No copy created, modifies original file directly\n```\n\n**Based on user choice:**\n- **Optimize**: Continue to Step 2-8 (full workflow)\n- **Keep original**: Skip Steps 2-5, copy file \u2192 Step 6-8 (run script on copy)\n- **Typography only**: Skip Steps 2-6, run Step 7 on original file directly\n\n### Step 2: Analyze Content Structure\n\nIdentify:\n- Existing title (H1 `#`)\n- Paragraph separations\n- Keywords suitable for **bold**\n- Parallel content convertible to lists\n- Code snippets\n- Quotations\n\n### Step 3: Check\/Create Frontmatter\n\nCheck for YAML frontmatter (`---` block). Create if missing.\n\n**Meta field handling:**\n\n| Field | Processing |\n|-------|------------|\n| `title` | See Step 4 |\n| `slug` | Infer from file path (e.g., `posts\/2026\/01\/10\/vibe-coding\/` \u2192 `vibe-coding`) or generate from title |\n| `summary` | Generate engaging summary (100-150 characters) |\n| `featureImage` | Check if `imgs\/cover.png` exists in same directory; if so, use relative path |\n\n### Step 4: Title Handling\n\n**Logic:**\n1. If frontmatter already has `title` \u2192 use it, no H1 in body\n2. If first line is H1 \u2192 extract to frontmatter `title`, remove H1 from body\n3. If neither exists \u2192 generate candidate titles\n\n**Title generation flow:**\n\n1. Generate 3 candidate titles based on content\n2. Use `AskUserQuestion` tool:\n\n```\nSelect a title:\n\n1. [Title A] (Recommended)\n2. [Title B]\n3. [Title C]\n```\n\n3. If no selection within a few seconds, use recommended (option 1)\n\n**Title principles:**\n- Concise, max 20 characters\n- Captures core message\n- Engaging, sparks reading interest\n- Accurate, avoids clickbait\n\n**Important:** Once title is in frontmatter, body should NOT have H1 (avoid duplication)\n\n### Step 5: Format Processing\n\n**Formatting rules:**\n\n| Element | Format |\n|---------|--------|\n| Titles | Use `#`, `##`, `###` hierarchy |\n| Key points | Use `**bold**` |\n| Parallel items | Convert to `-` unordered or `1.` ordered lists |\n| Code\/commands | Use `` `inline` `` or ` ```block``` ` |\n| Quotes\/sayings | Use `>` blockquote |\n| Separators | Use `---` where appropriate |\n\n**Formatting principles:**\n- Preserve original content and viewpoints\n- Add formatting only, do not modify text\n- Formatting serves readability\n- Avoid over-formatting\n\n### Step 6: Save Formatted File\n\nSave as `{original-filename}-formatted.md`\n\nExamples:\n- `final.md` \u2192 `final-formatted.md`\n- `draft-v1.md` \u2192 `draft-v1-formatted.md`\n\n**If user chose \"Keep original formatting\" (from Step 1.5):**\n- Copy original file to `{filename}-formatted.md` without modifications\n- Proceed to Step 7 for typography fixes only\n\n**Backup existing file:**\n\nIf `{filename}-formatted.md` already exists, backup before overwriting:\n\n```bash\n# Check if formatted file exists\nif [ -f \"{filename}-formatted.md\" ]; then\n  # Backup with timestamp\n  mv \"{filename}-formatted.md\" \"{filename}-formatted.backup-$(date +%Y%m%d-%H%M%S).md\"\nfi\n```\n\nExample:\n- `final-formatted.md` exists \u2192 backup to `final-formatted.backup-20260128-143052.md`\n\n### Step 7: Execute Text Formatting Script\n\nAfter saving, **must** run the formatting script:\n\n```bash\nnpx -y bun ${SKILL_DIR}\/scripts\/main.ts {output-file-path} [options]\n```\n\n**Script Options:**\n\n| Option | Short | Description | Default |\n|--------|-------|-------------|---------|\n| `--quotes` | `-q` | Replace ASCII quotes with fullwidth quotes `\"...\"` | false |\n| `--no-quotes` | | Do not replace quotes | |\n| `--spacing` | `-s` | Add CJK\/English spacing via autocorrect | true |\n| `--no-spacing` | | Do not add CJK\/English spacing | |\n| `--emphasis` | `-e` | Fix CJK emphasis punctuation issues | true |\n| `--no-emphasis` | | Do not fix CJK emphasis issues | |\n| `--help` | `-h` | Show help message | |\n\n**Examples:**\n\n```bash\n# Default: spacing + emphasis enabled, quotes disabled\nnpx -y bun ${SKILL_DIR}\/scripts\/main.ts article.md\n\n# Enable all features including quote replacement\nnpx -y bun ${SKILL_DIR}\/scripts\/main.ts article.md --quotes\n\n# Only fix emphasis issues, skip spacing\nnpx -y bun ${SKILL_DIR}\/scripts\/main.ts article.md --no-spacing\n\n# Disable all processing except frontmatter formatting\nnpx -y bun ${SKILL_DIR}\/scripts\/main.ts article.md --no-spacing --no-emphasis\n```\n\n**Script performs (based on options):**\n1. Fix CJK emphasis\/bold punctuation issues (default: enabled)\n2. Add CJK\/English mixed text spacing via autocorrect (default: enabled)\n3. Replace ASCII quotes `\"...\"` with fullwidth quotes `\"...\"` (default: disabled)\n4. Format frontmatter YAML (always enabled)\n\n### Step 8: Display Results\n\n```\n**Formatting complete**\n\nFile: posts\/2026\/01\/09\/example\/final-formatted.md\n\nChanges:\n- Added title: [title content]\n- Added X bold markers\n- Added X lists\n- Added X code blocks\n```\n\n## Formatting Example\n\n**Before:**\n```\nThis is plain text. First point is efficiency improvement. Second point is cost reduction. Third point is experience optimization. Use npm install to install dependencies.\n```\n\n**After:**\n```markdown\n---\ntitle: Three Core Advantages\nslug: three-core-advantages\nsummary: Discover the three key benefits that drive success in modern projects.\n---\n\nThis is plain text.\n\n**Main advantages:**\n- Efficiency improvement\n- Cost reduction\n- Experience optimization\n\nUse `npm install` to install dependencies.\n```\n\n## Notes\n\n- Preserve original writing style and tone\n- Specify correct language for code blocks (e.g., `python`, `javascript`)\n- Maintain CJK\/English spacing standards\n- Do not add content not present in original\n\n## Extension Support\n\nCustom configurations via EXTEND.md. See **Preferences** section for paths and supported options.\n","use_cases":["Optimize markdown formatting for blog posts","Convert plain text articles to markdown with frontmatter","Standardize content structure for publishing"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/anbeime\/skill\/blob\/7d96c7f464535c90bd6efde99821a9d3446bf0cb\/skills\/content-creation-publisher\/baoyu-format-markdown\/SKILL.md","source_commit":"7d96c7f464535c90bd6efde99821a9d3446bf0cb","license":null,"version":null,"listing_approved_at":"2026-11-22","created_at":"2026-11-21T16:55:16.000000Z","updated_at":"2026-11-22T11:18:35.000000Z","seo_title":"Markdown Formatter for Content Optimization","seo_description":"Automatically format plain text or markdown files with frontmatter, typography, and structure for professional results.","seo_keywords":["markdown formatter","content formatting","markdown optimization","frontmatter generator","text to markdown"]}}