Markdown formatter

From bighardperson/computer-science-skills-collection · View interactive version

Markdown formatter is an AI agent skill from the GitHub repository bighardperson/computer-science-skills-collection. Format and beautify markdown documents with configurable styles. Preserve structure, fix formatting, ensure consistency.

How to use this skill

Skill file

Markdown-Formatter - Beautify Your Markdown

Vernox Utility Skill - Make your markdown look professional.

Overview

Markdown-Formatter is a powerful tool for formatting, linting, and beautifying markdown documents. Supports multiple style guides (CommonMark, GitHub Flavored Markdown, custom rules) and handles everything from simple cleanup to complex reformatting.

Features

✅ Formatter Engine

✅ Linting & Cleanup

✅ Beautification

✅ Validation

Installation

clawhub install markdown-formatter

Quick Start

Format a Document

const result = await formatMarkdown({
  markdown: '# My Document\n\n\n## Section 1\nContent here...',
  style: 'github',
  options: {
    maxWidth: 80,
    headingStyle: 'atx'
  }
});

console.log(result.formattedMarkdown);

Beautify Multiple Files

const results = await formatBatch({
  markdownFiles: ['./doc1.md', './doc2.md', './README.md'],
  style: 'github',
  options: { wrapWidth: 80 }
});

results.forEach(result => {
  console.log(`${result.file}: ${result.warnings} warnings`);
});

Lint and Fix

const result = await lintMarkdown({
  markdown: '# My Document\n\n\nBad list\n\n- item 1\n- item 2',
  style: 'github'
});

console.log(`Errors found: ${result.errors}`);
console.log(`Fixed: ${result.fixed}`);

Tool Functions

`formatMarkdown`

Format markdown content according to style guide.

Parameters:

Returns:

`formatBatch`

Format multiple markdown files at once.

Parameters:

Returns:

`lintMarkdown`

Check markdown for issues without formatting.

Parameters:

Returns:

Style Guides

CommonMark (default)

GitHub Flavored Markdown

Consistent (default)

Custom

Use Cases

Documentation Cleanup

Content Creation

Technical Writing

README Generation

Markdown Conversion

Configuration

Edit `config.json`:

{
  "defaultStyle": "github",
  "maxWidth": 80,
  "headingStyle": "atx",
  "listStyle": "consistent",
  "codeStyle": "fenced",
  "emphasisStyle": "asterisk",
  "linkStyle": "inline",
  "customRules": [],
  "linting": {
    "checkLinks": true,
    "checkHeadingLevels": true,
    "checkListConsistency": true
  }
}

Examples

Simple Formatting

const result = await formatMarkdown({
  markdown: '# My Title\n\n\nThis is content.',
  style: 'github'
});

console.log(result.formattedMarkdown);

Complex Beautification

const result = await formatMarkdown({
  markdown: '# Header 1\n## Header 2\n\nParagraph...',
  style: 'github',
  options: {
    fixLists: true,
    normalizeSpacing: true,
    wrapWidth: 80
  }
});

console.log(result.formattedMarkdown);

Linting and Fixing

const result = await lintMarkdown({
  markdown: '# Title\n\n- Item 1\n- Item 2\n\n## Section 2',
  style: 'github'
});

console.log(`Errors: ${result.errors.length}`);
result.errors.forEach(err => {
  console.log(`  - ${err.message} at line ${err.line}`);
});

// Fix automatically
const fixed = await formatMarkdown({
  markdown: result.fixed,
  style: 'github'
});

Batch Processing

const results = await formatBatch({
  markdownFiles: ['./doc1.md', './doc2.md', './README.md'],
  style: 'github'
});

console.log(`Processed ${results.totalFiles} files`);
console.log(`Total warnings: ${results.totalWarnings}`);

Performance

Speed

Accuracy

Error Handling

Invalid Input

Markdown Parsing Errors

File I/O Errors

Troubleshooting

Format Not Applied

Linting Shows Too Many Errors

Tips

Best Results

Performance Optimization

License

MIT


Format markdown. Keep your docs beautiful. 🔮

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.