Markdown Mirror TranslatorMarkdown Mirror Translator is a VS Code extension for translating Markdown source files into editable Markdown files while keeping the original document open beside a read-only translated result. It is not a Markdown preview renderer. It does not replace VS Code's built-in Markdown Preview or dedicated preview extensions. Its job is to translate Markdown source text, preserve common Markdown structures, show the translated Markdown in a side editor, and save the result as a separate Features
What This Extension Does Not Do
Commands
|
| Setting | Default | Description |
|---|---|---|
markdownMirrorTranslator.sourceLanguage |
"" |
Source language code. Leave empty to let the provider accept any source language. |
markdownMirrorTranslator.targetLanguage |
"zh-CN" |
Target language code for translated Markdown. |
markdownMirrorTranslator.bilingual |
false |
When false, show translated-only Markdown. When true, show source and translated blocks together. |
markdownMirrorTranslator.translationUpdateMode |
"manual" |
Translation update mode. manual is implemented. auto is reserved and currently behaves as manual. |
markdownMirrorTranslator.syncScroll |
true |
Synchronize scrolling between the source editor and translated virtual editor. |
Example:
{
"markdownMirrorTranslator.sourceLanguage": "",
"markdownMirrorTranslator.targetLanguage": "zh-CN",
"markdownMirrorTranslator.bilingual": false,
"markdownMirrorTranslator.translationUpdateMode": "manual",
"markdownMirrorTranslator.syncScroll": true
}
Usage
- Open a
.mdfile in VS Code. - Run
Markdown Mirror Translator: Translate Current File. - The original Markdown file remains open, and a read-only translated Markdown document opens beside it.
- Review the translated Markdown source.
- Scroll either editor to follow the corresponding source or translated area in the paired editor.
- Run
Markdown Mirror Translator: Save Translated Filefrom the translated document when you want a real editable file.
If you edit the source Markdown after translating, run Translate Current File again manually. The extension intentionally does not retranslate automatically while you type.
Output Modes
Translated-only Markdown
Source:
# Hello
This is a document.
Translated result:
# 你好
这是一个文档。
Bilingual Markdown
Source:
# Hello
This is a document.
Bilingual result:
# Hello
# 你好
This is a document.
这是一个文档。
Bilingual output is block-adjacent by design and preserves original blank Markdown lines. It does not attempt complex layout or rendered preview formatting.
Saving Translated Files
Translated results are initially stored in a read-only virtual document managed by the extension. To edit or preview the result with another Markdown tool, save it as a real file first.
Default naming:
| Source file | Mode | Saved file |
|---|---|---|
README.md |
Translated-only | README.zh-CN.md |
README.md |
Bilingual | README.bilingual.zh-CN.md |
If the target file already exists, the extension asks for confirmation before overwriting it.
Markdown Structure Protection
The extension tries to avoid damaging Markdown syntax during translation.
Protected by default:
- Fenced code blocks
- Inline code
- URLs
- Markdown link URLs
- Image URLs
- Frontmatter blocks
- HTML blocks and inline HTML
- Pipe table separators and column structure
Translatable where possible:
- Heading text
- Paragraph text
- List item text
- Block quote text
- Table row text
- Markdown link labels
- Image alt text
Translation Provider
The MVP uses the internal google-free provider by default. It calls the non-official Google Translate endpoint and does not require an API key.
The provider is intentionally isolated behind an internal provider interface. Future providers can be added without changing the Markdown parser, renderer, cache, or scheduler.
Error Handling
- If a single block fails to translate, the translated document keeps the original source block for that section.
- If some blocks fail, the extension shows a partial-failure message after translation completes.
- You can run
Translate Current Fileagain to retry. - Cached successful blocks can be reused on later runs.
Related Tools
The following links are provided as related tools in the Markdown translation and preview ecosystem:
Contributing
This README is user-facing documentation. Development setup, local debugging, testing, and contribution workflow are documented in CONTRIBUTING.md.
License
MIT.