Install
openclaw skills install auto-md2imgClawHub Security found sensitive or high-impact capabilities. Review the scan results before using.
Convert Markdown content to images automatically with GitHub styling, full Chinese support, smart pagination, emoji support, and syntax highlighting. Supports height-based pagination and JPEG quality adjustment.
openclaw skills install auto-md2imgAutomatically converts Markdown content to images for sending in any messaging platform, improving reading experience.
When you need to reply to users with Markdown formatted content:
scripts/md_to_png.js to generate images<img> tags# Basic usage
node scripts/md_to_png.js input.md
# Specify output directory
node scripts/md_to_png.js input.md ./output
# Custom lines per page
node scripts/md_to_png.js input.md ./output 300
# Custom JPEG quality (1-100, default 80)
node scripts/md_to_png.js input.md ./output 300 75
# Height-based pagination (custom height threshold in pixels, e.g. 2000px)
node scripts/md_to_png.js input.md ./output --height 2000
# Disable pagination entirely (output single image)
node scripts/md_to_png.js input.md ./output --height 0
# Enable Debug mode (output detailed logs + save pagination content)
node scripts/md_to_png.js input.md ./output --debug
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
inputFile | string | ✅ | - | Path to input Markdown file |
outputDir | string | ❌ | Current directory | Output image directory |
maxLinesPerPage | number | ❌ | 500 | Maximum lines per page (line-based pagination) |
imageQuality | number | ❌ | 80 | JPEG image quality (1-100) |
--height <px> | number | ❌ | - | Height-based pagination threshold in pixels. ≤0 disables pagination entirely (single output image). Overrides line-based pagination. |
--debug | flag | ❌ | - | Enable Debug mode, output detailed logs and save intermediate pagination content |
--height parameter), independent of line count--height 0When enabled with --debug flag:
scripts/md_to_png.js - Main Markdown to image tool
scripts/md_to_png.js Functions:
import { exec } from 'child_process';
import path from 'path';
const markdownContent = `# Hello World\n\nThis is test content.`;
// Save to temporary file
const tempFile = path.join('/tmp', 'temp.md');
fs.writeFileSync(tempFile, markdownContent);
// Call conversion script
exec(`node scripts/md_to_png.js ${tempFile}`, (error, stdout, stderr) => {
if (error) {
console.error('Conversion failed:', error);
return;
}
console.log('Conversion successful:', stdout);
});
// When needing to reply with Markdown content
async function replyWithMarkdown(content, outputDir) {
try {
// Call md2img conversion
const baseName = `reply_${Date.now()}`;
const files = await convertMarkdown(content, outputDir, baseName);
// Send images using <img> tags
for (const file of files) {
await sendMessage(`<img src="${file.path}">`);
}
} catch (error) {
// Fall back to plain text on failure
await sendMessage(content);
}
}
# Split by 2000px height, ideal for mobile viewing
node scripts/md_to_png.js long_article.md ./output --height 2000
# No pagination, output single long image
node scripts/md_to_png.js short_note.md ./output --height 0
# JPEG quality adjustment for faster sharing
node scripts/md_to_png.js report.md ./output 500 60 --height 1500
# Debug mode for troubleshooting conversion issues
node scripts/md_to_png.js problem_content.md ./output --debug
| Metric | Value |
|---|---|
| First browser startup | ~260ms |
| Small document conversion (200 words) | ~2.3s |
| Medium document conversion (2KB) | ~2.6s |
| Large document conversion (5KB) | ~3.6s |
| Repeated conversion performance improvement | 4.5% (single) / 50-70% (batch) |
Supported Markdown elements:
All reply scenarios that require outputting Markdown formatted content:
skipCacheClear configuration for batch conversionsWhen you need to reply to users with Markdown formatted content:
scripts/md_to_png.js to generate images<img> tagsscripts/md_to_png.js - Markdown to image tool
Auto MD2IMG Skill - Make Markdown replies more beautiful! 🎉