SuperAPI AI Directory

markdown-formatter

General & other

View repository

Updated 10-16 08:46

About this skill

Markdown Document Formatting Skill

Workflow

When the user requests formatting a document, execute in the following order:

1. Syntax checking and fixing

Use the markdown-checker script to check the document:

python3 ~/.claude/skills/markdown-checker/scripts/check_markdown.py "文件路径"

Fix priority:

  • ❌ Error: must fix (link format, code block closure, list format)
  • ⚠️ Warning: recommended to fix (trailing spaces, punctuation, indentation)
  • ℹ️ Hint: optional fix (layout suggestions)

Note:

  • The YAML frontmatter's --- will be falsely reported as a list; ignore this error
  • Only fix issues that truly affect syntax; do not over-optimize

2. Intelligent paragraphing

Paragraphing principles:

  • Long paragraphs (over 100 characters) need to be split into paragraphs
  • Split after periods, question marks, and exclamation marks
  • Split after colons and semicolons (if a complete sentence follows)
  • Maintain semantic integrity; do not break logical coherence

Paragraphing example:

原句:今天研究了语音输入法,基于 fun-asr-nano,很有意思。其实核心是速度和准确度。

分段后:
今天研究了语音输入法,基于 fun-asr-nano,很有意思。

其实核心是速度和准确度。

3. Layout optimization

Must fix:

  • Remove trailing spaces
  • Remove consecutive blank lines (keep at most 2 lines)
  • Fix obvious layout errors

Optional optimization:

  • Add spaces between Chinese and English (e.g. 。Claude → 。 Claude)
  • Add a space after Chinese punctuation (if English follows)

Why:

  • Issues that must be fixed affect document quality
  • Optional optimization is personal preference; do not over-modify

4. Content cleanup

Check items:

  • Remove duplicate blank lines
  • Unify list markers (use - or *, keep consistent)
  • Check YAML frontmatter format
  • Verify whether image links are valid

5. Emoji image reference handling

Recognition patterns:

![😂](https://abs-0.twimg.com/emoji/v2/svg/1f602.svg "乐极而泣脸")

Handling rules:

  • If the alt text contains an emoji (e.g. 😂), directly replace the entire image reference with the emoji
  • If the alt text does not contain an emoji, delete the entire image reference
  • Twitter/X emoji image links usually come from abs-0.twimg.com/emoji/v2/svg/

Handling example:

原内容:![😂](https://abs-0.twimg.com/emoji/v2/svg/1f602.svg "乐极而泣脸")
替换后:😂

原内容:![图像](https://abs-0.twimg.com/emoji/v2/svg/1f602.svg)
替换后:(删除)

Why:

  • Emoji images take up a very large area when reading, affecting the reading experience
  • Using emoji directly is more concise and does not take up extra space
  • Twitter/X emoji links are in SVG format and are not suitable for direct display in markdown

User preferences

Formatting style:

  • Prioritize ensuring syntax correctness
  • Keep the original meaning unchanged
  • Paragraphs should be reasonable and easy to read
  • Do not over-modify the original text

When handling clipping documents:

  • These documents are usually scraped from platforms such as Twitter/X
  • The content may be very dense and needs reasonable paragraphing
  • Preserve the original information; only optimize the format

Verification steps

After formatting is complete:

  1. Re-run markdown-checker to confirm the errors have been fixed
  2. Read the file to confirm the content semantics are correct
  3. Tell the user which issues were fixed
  4. Ask whether further optimization is needed

Special cases

Do not automatically modify:

  • Code block content (unless the user explicitly requests it)
  • Special formatting (such as tables, mathematical formulas)
  • User-defined formatting

Requires confirmation:

  • For large numbers of modifications (more than 10), inform the user first
  • Ask first for operations involving content rewriting
  • Ask first about places where it is uncertain whether modification should be made