T

tomark-skill

办公效率v1.0.0
作者:user_f474679a更新于 2026-10-01@user_f474679a/tomark-skill
文档处理流程自动化

据 AlphaMoat 统计,截至 2026-09,tomark-skill 累计下载 1,201 次、获 0 个星标,在全部 5,078 个 AI 技能中排名第 4,936 位,在「办公效率」分类(435 个)中排名第 415 位。

累计安装
129
累计下载
1,201
星标
-
全站排名
#4,936
全站前 98% · 「办公效率」前 96%
平台累计安装累计下载星标评论
SkillHub ↗1291,201-—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

该技能把 DOCX 文档转换为 Markdown,并可按原有结构保留标题、粗体与列表;DOC 和 WPS 文件需要先通过 Windows 上的 WPS Office COM 转为 DOCX,再继续转换。批量任务可保留子目录结构。运行前应确认文件范围、目标目录以及所需转换环境,尤其是旧格式对 Windows/WPS 的依赖。

资料发布于 2026-10-29

可以用来做什么

  • 将单个 DOCX 文件转换为 Markdown
  • 批量转换 DOC、DOCX 或 WPS 文档
  • 保留批量输入的子目录结构

什么时候用

  • 用户要求将 Word/WPS 文件转为 Markdown 时
  • 目标文件格式和输出位置已确认时
  • 可以提供所需的 mammoth 或 Windows/WPS 转换环境时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

将这个文件夹中的 DOCX 文档批量转为 Markdown,并保留子目录结构;先列出将处理的文件和输出目录。

月度数据趋势

累计下载1,201
26461,2902026-03 · 累计下载 912026-05 · 累计下载 4342026-06 · 累计下载 5802026-07 · 累计下载 8202026-08 · 累计下载 9522026-09 · 累计下载 1,20126-0326-09
星标-
0112026-03 · 星标 -2026-05 · 星标 -2026-06 · 星标 -2026-07 · 星标 -2026-08 · 星标 -2026-09 · 星标 -26-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-091,201—-
2026-08952+16.1%-
2026-07820+41.4%-
2026-06580+33.6%-
2026-05434—-
2026-0391—-

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

3.5 KB · SkillHub v1.0.0
---
name: tomark-skill
description: >
  This skill should be used when the user wants to convert documents (.doc, .docx, .wps)
  to Markdown format — either a single file or an entire folder in batch.
  Trigger phrases include: "转为markdown", "转成md", "文档转markdown", "批量转换markdown",
  "convert to markdown", "doc to md", "wps转markdown".
  Provides a ready-to-run Python script that handles .docx (via mammoth), and .doc/.wps
  (via WPS Office COM automation on Windows), producing clean Chinese-language Markdown
  with no garbled characters.
展开全部(共 130 行)
---

# tomark-skill — 文档批量转 Markdown

## Overview

To convert Word/WPS documents (.doc, .docx, .wps) to Markdown (.md) format.

**Supported formats:**
- `.docx` — converted via `mammoth` (preserves headings, bold, lists)
- `.doc` / `.wps` — converted via WPS Office COM (`KWps.Application`) to .docx first, then mammoth
- Batch or single file, with sub-directory structure preserved

**Prerequisites (Windows):**
- Python 3.x
- `mammoth` library: `pip install mammoth`
- `pywin32` library: `pip install pywin32`
- WPS Office installed (for .doc/.wps files)

---

## Workflow Decision Tree

```
User request
    │
    ├─ Single file?
    │       └─ Call convert_file() directly
    │
    └─ Folder / batch?
            └─ Run scripts/convert_to_markdown.py with SRC_DIR set
```

---

## Step 1 — Check Prerequisites

To verify the environment before running:

```python
import shutil, importlib

# Check mammoth
try:
    import mammoth
    print("mammoth: ok")
except ImportError:
    print("mammoth: MISSING — run: pip install mammoth")

# Check pywin32 (for .doc/.wps)
try:
    import win32com.client
    print("pywin32: ok")
except ImportError:
    print("pywin32: MISSING — run: pip install pywin32")

# Check WPS Office
import glob
wps = glob.glob("C:/Program Files (x86)/Kingsoft/WPS Office/*/office6/wps.exe")
print("WPS Office:", wps[0] if wps else "NOT FOUND")
```

If WPS Office is not installed, `.doc`/`.wps` files cannot be converted.
Only `.docx` files can be processed with mammoth alone.

---

## Step 2 — Configure and Run

To run the batch conversion script:

1. Open `scripts/convert_to_markdown.py`
2. Set `SRC_DIR` to the source folder path
3. Optionally set `OUT_DIR` (default: `<SRC_DIR>/markdown_output/`)
4. Run: `python -X utf8 scripts/convert_to_markdown.py`

To convert a single file inline:

```python
from pathlib import Path
# import the helper functions from the script
from scripts.convert_to_markdown import convert_file

src = Path(r"D:\documents\example.doc")
out = Path(r"D:\documents\example.md")
ok, msg = convert_file(src, out)
print(ok, msg)
```

---

## Step 3 — Interpret the Output

After conversion completes:

- All `.md` files are in `OUT_DIR`, mirroring the original sub-directory structure
- A `转换报告.md` report is generated listing successes and failures
- Typical failure causes:
  - WPS Office not installed (for .doc/.wps)
  - Password-protected documents
  - Severely corrupted files

---

## Encoding Notes

- Always run with `python -X utf8` on Windows to avoid GBK encoding issues
- The script forces `sys.stdout` to UTF-8 internally
- Output `.md` files are always written as UTF-8

---

## Resources

### scripts/
- `convert_to_markdown.py` — main batch conversion script (configure `SRC_DIR` at the top)

### references/
- `format_guide.md` — notes on mammoth output format and post-processing tips

「办公效率」分类下的热门技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。