A powerful markdown translation skill for AI agents that efficiently handles large documents with streaming mode and progressive splitting.
- Streaming I/O: Reads files line by line with 8KB buffer, handles files of any size without memory issues
- Progressive Splitting: Splits at heading levels (## → ### → ####) ensuring clean segment breaks
- Token Efficiency: Separates code blocks, tables, links, and images from translatable text
- Multi-language Support: Supports 15+ programming languages for code comment translation
- Format Preservation: Maintains markdown structure during translation
# Install the skill
npx skills add your-username/markdown-translator# Or use directly
python scripts/translate_all.py input.md segments 2python scripts/translate_all.py <input_file> <output_dir> <heading_level>- Split:
python scripts/split_md.py input.md segments 2 - Translate Body: Read segments, translate, save to
segments/translated/body/ - Translate Code:
python scripts/translate_code.py segments/code_blocks - Translate Tables:
python scripts/translate_table.py segments/tables - Merge:
python scripts/merge_md.py segments output.md
segments/
├── body/ # Plain text segments
├── code_blocks/ # Code files
├── tables/ # Table files
├── translated/ # Translated content
│ ├── body/
│ ├── code_blocks/
│ └── tables/
├── links.json
└── manifest.json
| Script | Purpose |
|---|---|
translate_all.py |
One-click entry point for preprocessing |
split_md.py |
Stream-split markdown into segments |
translate_md.py |
Generate translation prompts for body text |
translate_code.py |
Extract and translate code comments/strings |
translate_table.py |
Extract and translate table content |
merge_md.py |
Merge translated parts back together |
MIT License