360 Secure SkillHub
360 安全技能中心

MD Formatter

该 Skill 提供 md-formatter,通过本地 Python 脚本对 Markdown 文件做规范化:统一标题从一级开始且不跳级、把下划线式标题转为井号式、规范链接写法、清理尾随空格、统一粗斜体符号,并保证标题与代码块前后空行;同时附带标题语法参考文档以及检查、运行、验证、迭代的工作流程。

分类:效率
terrycarter1985
terrycarter1985
热度 12.22
最近更新 2026-07-22 10:16:15

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add terrycarter1985/md-formatter
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
md-formatter
description
Format and lint markdown files for consistency and readability. Use when Codex needs to normalize markdown documents, fix heading levels, standardize link formats, add missing alt text, or apply consistent formatting conventions across markdown files. Triggers include "format markdown", "clean up this md", "lint markdown", "normalize headings in this file".

MD Formatter

Format and lint markdown files with consistent conventions.

Quick Start

Run the formatter script on a file:

python3 scripts/format_md.py <file.md>

The script performs:

  1. Heading normalization: Promote headings to start at #, ensure no level skips (e.g., # → ###), convert ===/--- underlined headings to # style.
  2. Link formatting: Convert <https://url> to [url](https://url) when appropriate, standardize bare URLs.
  3. Trailing whitespace: Remove it.
  4. Bold/italic consistency: Prefer **bold** over __bold__, *italic* over _italic_.
  5. Empty lines: Ensure one blank line before and after headings and code blocks.

Workflow

1. Inspect the file

Read the markdown file to understand its current state.

2. Run the formatter script

Execute scripts/format_md.py with the target path. Check the diff output.

3. Verify formatting

Read the formatted file to confirm changes are correct and no content was accidentally altered.

4. Iterate if needed

For complex documents, manually review or adjust formatting the script doesn't cover.

References

See references/heading-syntax.md for markdown heading specification details.