Skip to content

[FEATURE][PLUGIN]: Create Markdown Cleaner plugin #999

@crivetimihai

Description

@crivetimihai

Overview

Create a Markdown Cleaner Plugin that normalizes and tidies Markdown content in prompts and resources for improved consistency and readability.

Plugin Requirements

Plugin Details

  • Name: MarkdownCleanerPlugin
  • Type: Self-contained (native) plugin
  • File Location: plugins/markdown_cleaner/
  • Complexity: Medium

Functionality

  • Normalize Markdown formatting and structure
  • Fix common Markdown syntax issues
  • Standardize heading styles and list formatting
  • Remove unnecessary whitespace and formatting
  • Support for custom cleaning rules

Hook Integration

  • Primary Hooks: prompt_post_fetch, resource_post_fetch
  • Purpose: Clean and normalize Markdown content for better processing
  • Behavior: Apply cleaning rules to Markdown content automatically

Configuration Schema

plugins:
  - name: "MarkdownCleaner"
    kind: "plugins.markdown_cleaner.cleaner.MarkdownCleanerPlugin"
    description: "Normalize and tidy Markdown in prompts/resources"
    version: "0.1.0"
    hooks: ["prompt_post_fetch", "resource_post_fetch"]
    mode: "permissive"
    priority: 3
    conditions:
      - content_types: ["text/markdown", "text/x-markdown"]
    config:
      # Cleaning rules
      cleaning_rules:
        normalize_headings: true
        fix_list_formatting: true
        remove_trailing_whitespace: true
        normalize_line_breaks: true
        fix_link_formatting: true
        standardize_emphasis: true
        remove_empty_lines: true
      
      # Heading normalization
      heading_style:
        prefer_atx: true  # # Header vs Header\n======
        max_heading_level: 6
        ensure_space_after_hash: true
        normalize_case: false
      
      # List formatting
      list_formatting:
        bullet_style: "-"  # - vs * vs +
        number_style: "1."  # 1. vs 1) vs (1)
        indent_size: 2
        normalize_spacing: true
      
      # Link and image handling
      link_processing:
        normalize_reference_links: true
        fix_broken_links: true
        standardize_alt_text: true
      
      # Code block formatting
      code_blocks:
        fence_style: "```"  # ``` vs ~~~
        ensure_language_tags: false
        normalize_indentation: true
      
      # Whitespace handling
      whitespace:
        max_consecutive_empty_lines: 2
        trim_trailing_spaces: true
        normalize_tabs_to_spaces: true
        tab_size: 2

Acceptance Criteria

  • Plugin implements MarkdownCleanerPlugin class
  • Normalizes Markdown formatting and structure
  • Fixes common Markdown syntax issues
  • Standardizes heading and list formatting
  • Configurable cleaning rules
  • Plugin manifest and documentation created
  • Unit tests with >85% coverage

Priority

Low-Medium - Content formatting utility

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions