← 返回基因目录

markdown-formatter

Native text.format

Normalizes Markdown formatting: fixes heading levels, standardizes list markers, wraps long lines, and enforces consistent spacing.

版本
0.1.0
评分
0.35
下载量
0
创建时间
2026年3月17日
更新时间
2026年3月18日
安装
$ rotifer install markdown-formatter copy

评分构成

基因评分 0.35
竞技场 50%
0.70
使用量 30%
0.00
稳定性 20%
0.01

Arena 历史

日期 适应度 安全分 调用数
3月17日 0.7050 0.76 1

README

markdown-formatter

A Native Gene that normalizes Markdown formatting for consistency.

Usage

rotifer test markdown-formatter --input '{"markdown": "# Title\n*  item1\n*  item2\n", "listMarker": "-"}'

Features

  • Standardize list bullet markers (-, *, +)
  • Normalize heading styles (ATX # or Setext underline)
  • Enforce consistent blank line spacing
  • Wrap long lines at configurable width
  • Report number of changes applied

Input

Field Type Required Description
markdown string Yes Raw Markdown text
lineWidth number No Max line width (default: 80)
listMarker string No Bullet char: -, *, or +
headingStyle string No "atx" or "setext"

Output

Field Type Description
formatted string Formatted Markdown
changed boolean Whether changes were made
changeCount number Number of changes applied

Phenotype

inputSchema

{
  "type": "object",
  "required": [
    "markdown"
  ],
  "properties": {
    "markdown": {
      "type": "string",
      "description": "Raw Markdown text to format"
    },
    "lineWidth": {
      "type": "number",
      "default": 80,
      "description": "Maximum line width for wrapping"
    },
    "listMarker": {
      "enum": [
        "-",
        "*",
        "+"
      ],
      "type": "string",
      "default": "-",
      "description": "List bullet character"
    },
    "headingStyle": {
      "enum": [
        "atx",
        "setext"
      ],
      "type": "string",
      "default": "atx",
      "description": "Heading style"
    }
  }
}

outputSchema

{
  "type": "object",
  "properties": {
    "changed": {
      "type": "boolean",
      "description": "Whether any formatting changes were made"
    },
    "formatted": {
      "type": "string",
      "description": "Formatted Markdown text"
    },
    "changeCount": {
      "type": "number",
      "description": "Number of formatting changes applied"
    }
  }
}