--- name: markdown-converter description: A versatile Markdown conversion tool that supports converting Markdown to HTML, PNG images, and plain text formats. metadata: {"clawdbot":{"emoji":"📝","os":["linux","darwin","win32"]}} --- # Markdown Converter A versatile Markdown conversion tool that supports converting Markdown to HTML, PNG images, and plain text formats. ## Features - **HTML Conversion**: High-quality Markdown to HTML conversion - **PNG Output**: Render Markdown as PNG images - **CJK Support**: Uses system CJK fonts for Chinese character rendering - **Code Highlighting**: Syntax highlighting for code blocks - **Clean Output**: Removes invisible Unicode characters ## Installation ```bash pip install matplotlib html2text pygments markdown ``` ## Dependencies - **matplotlib**: PNG image rendering with excellent CJK support - **html2text**: HTML and Markdown conversion - **Pygments**: Code syntax highlighting - **markdown**: Python Markdown processor ## Usage ```bash # Convert to HTML python scripts/md_convert.py input.md output.html # Convert to PNG python scripts/md_convert.py input.md output.png # Convert to plain text python scripts/md_convert.py input.md output.txt ``` ## Output Formats ### HTML - Complete HTML document structure - Inline CSS styling - Code syntax highlighting - Responsive design ### PNG Card - White card background - Large title font - Automatic text wrapping - CJK character support ### Plain Text - Plain text output - Preserves basic formatting - Removes invisible characters ## Supported Platforms - **Windows**: Uses system CJK fonts - **macOS**: Uses PingFang and other system fonts - **Linux**: Uses NotoSansCJK and other fonts ## Workflow ``` Markdown Input ↓ [html2text / markdown library] ↓ HTML / PNG / Plain Text ``` ## Notes - PNG rendering requires Chinese fonts to be installed on the system - Code highlighting requires Pygments support - Large files may require longer processing time