Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown Translator Skill

A powerful markdown translation skill for AI agents that efficiently handles large documents with streaming mode and progressive splitting.

Features

  • 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

Getting Started

# Install the skill
npx skills add your-username/markdown-translator
# Or use directly
python scripts/translate_all.py input.md segments 2

Usage

One-Click Preprocessing

python scripts/translate_all.py <input_file> <output_dir> <heading_level>

Full Workflow

  1. Split: python scripts/split_md.py input.md segments 2
  2. Translate Body: Read segments, translate, save to segments/translated/body/
  3. Translate Code: python scripts/translate_code.py segments/code_blocks
  4. Translate Tables: python scripts/translate_table.py segments/tables
  5. Merge: python scripts/merge_md.py segments output.md

Directory Structure

segments/
├── body/                    # Plain text segments
├── code_blocks/             # Code files
├── tables/                  # Table files
├── translated/              # Translated content
│   ├── body/
│   ├── code_blocks/
│   └── tables/
├── links.json
└── manifest.json

Core Scripts

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

License

MIT License

About

A powerful markdown translation skill for AI agents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages