npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

md-ai-translator

v1.0.0

Published

使用 OpenAI API 翻译 MD/MDX 文件的 CLI工具

Downloads

2

Readme

MD AI Translator

一个使用 AI 技术翻译 Markdown/MDX 文档的命令行工具。

Read this in English

📖 简介

MD AI Translator 是一个专为技术文档设计的翻译工具,它利用 OpenAI API 来翻译 Markdown 和 MDX 文件,同时保留原始文档的格式和结构,确保代码块、标签和专业术语不被错误翻译。

✨ 特性

  • 保留代码块、HTML/JSX 标签、URL 和 Markdown 语法
  • 保持文档格式完整,包括空格、换行和缩进
  • 支持批量处理整个目录
  • 可配置的 AI 模型参数
  • 智能分块处理大文档
  • 自动重试失败的翻译任务

🚀 安装

确保你已安装 Node.js(>= 22.0.0):

# 使用 npm 安装
npm install -g md-ai-translator

# 或使用 yarn
yarn global add md-ai-translator

# 或使用 pnpm
pnpm add -g md-ai-translator

🛠️ 使用方法

# 基本用法
md-ai-translator -i ./input-folder -o ./output-folder

# 基本用法
md-ai-translator -i ./input-file -o ./output-file

# 使用自定义配置
md-ai-translator -i ./input-folder -o ./output-folder --model gpt-4-turbo --temperature 1.2 --chunk-size 4000

# 使用 API 参数
md-ai-translator -i ./input-folder -o ./output-folder --apikey YOUR_API_KEY --url https://custom-api-endpoint.com/v1

命令行参数

| 参数 | 描述 | 默认值 | |------|------|--------| | -i, --input <dir> | 输入目录/文件(必需) | - | | -o, --output <dir> | 输出目录/文件(必需) | - | | --model <model> | AI 模型 | gpt-4-1106-preview | | --temperature <number> | 生成温度 (0-2) | 1.3 | | --chunk-size <number> | 分块大小 | 3000 | | --apikey <key> | OpenAI API 密钥 | 从环境变量获取 | | --url <url> | OpenAI API 基础 URL | https://api.openai.com/v1 |

⚙️ 配置

你可以通过 .env 文件设置默认参数:

OPENAI_API_KEY=your_api_key_here
OPENAI_API_BASE_URL=https://api.openai.com/v1

📄 许可证

MIT


MD AI Translator

A command-line tool that uses AI to translate Markdown/MDX documents.

📖 Introduction

MD AI Translator is a translation tool specifically designed for technical documentation. It uses the OpenAI API to translate Markdown and MDX files while preserving the original document's format and structure, ensuring that code blocks, tags, and technical terms are not incorrectly translated.

✨ Features

  • Preserves code blocks, HTML/JSX tags, URLs, and Markdown syntax
  • Maintains complete document formatting, including spaces, line breaks, and indentation
  • Supports batch processing of entire directories
  • Configurable AI model parameters
  • Intelligent chunking for large documents
  • Automatic retry of failed translation tasks

🚀 Installation

Ensure you have Node.js (>= 22.0.0) installed:

# Install using npm
npm install -g md-ai-translator

# Or using yarn
yarn global add md-ai-translator

# Or using pnpm
pnpm add -g md-ai-translator

🛠️ Usage

# Basic usage
md-ai-translator -i ./input-folder -o ./output-folder

# Basic usage
md-ai-translator -i ./input-file -o ./output-file

# With custom configuration
md-ai-translator -i ./input-folder -o ./output-folder --model gpt-4-turbo --temperature 1.2 --chunk-size 4000

# With API parameters
md-ai-translator -i ./input-folder -o ./output-folder --apikey YOUR_API_KEY --url https://custom-api-endpoint.com/v1

Command-line Arguments

| Argument | Description | Default | |----------|-------------|---------| | -i, --input <dir> | Input directory/file (required) | - | | -o, --output <dir> | Output directory/file (required) | - | | --model <model> | AI model | gpt-4-1106-preview | | --temperature <number> | Generation temperature (0-2) | 1.3 | | --chunk-size <number> | Chunk size | 3000 | | --apikey <key> | OpenAI API key | From environment variable | | --url <url> | OpenAI API base URL | https://api.openai.com/v1 |

⚙️ Configuration

You can set default parameters using a .env file:

OPENAI_API_KEY=your_api_key_here
OPENAI_API_BASE_URL=https://api.openai.com/v1

📄 License

MIT