fix-markdown-fences

Repair malformed markdown code fence closings in documentation files.

41|13|Updated Dec 14, 2025
One-click install
npx skills add https://github.com/rjmurillo/ai-agents --skill fix-markdown-fences
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fix-markdown-fences
Source: https://github.com/rjmurillo/ai-agents/tree/main/.agents/utilities/fix-markdown-fences
Command: npx skills add https://github.com/rjmurillo/ai-agents --skill fix-markdown-fences

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Repairs closing markdown fences that incorrectly include language identifiers (```python) instead of plain closing fences, preventing rendering issues.

Core Features & Use Cases

  • Automatic fence repair: Scans markdown files and fixes closing fences.
  • Multi-language support: Implementations in Python, Bash, and PowerShell for cross-platform use.
  • Use Case: Prepare documentation before publishing to ensure correct markdown rendering.

Quick Start

Run the Python script on docs: python fix_markdown_fences.py docs Or use the included PowerShell script: pwsh fix_fences.ps1 -Directories docs

Frequently Asked Questions about fix-markdown-fences

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix malformed markdown code fences in my documentation?

Markdown code fences can be repaired by scanning for closing fences that incorrectly include language identifiers (like ```python) instead of plain closing markers (```). This Skill automatically detects and fixes these malformed closings, handling multiple blocks, nested blocks, and missing end-of-file closures across your docs.

What happens when a markdown closing fence includes a language identifier?

When a closing fence includes a language identifier, it prevents correct markdown rendering. The Skill detects this by tracking fence state line-by-line, inserts a plain closing fence before the misclosed line, and ensures proper fence pairing so documentation renders correctly.

Can I use this to fix markdown across an entire repository?

Yes. The Skill scans markdown files across repositories and generation workflows, applying repairs systematically. It supports batch processing through Python, Bash, and PowerShell implementations, making it suitable for preparing documentation before publishing.

Does this handle nested code blocks and missing closing fences?

Yes. The Skill handles nested blocks, cases where closing fences include language tags, and files missing closing fences at end-of-file by appending the required plain closing fence automatically.

What platforms and languages does this Skill support?

The Skill provides reference implementations in Python, Bash, and PowerShell for cross-platform use. It works with documentation containing code blocks in Python, Bash, and PowerShell contexts.

When should I run this before publishing documentation?

Run this Skill as a pre-publication step to ensure all markdown fences are correctly formatted. It prevents rendering issues caused by malformed closings and is essential when documentation has been edited across multiple workflows or contributors.