T

tomark-skill

Officev1.0.0
By user_f474679aUpdated 2026-10-01@user_f474679a/tomark-skill
DocumentsProcess Automation

According to AlphaMoat, as of 2026-09, tomark-skill has 1,201 downloads and 0 stars — ranked #4,936 of 5,078 AI skills overall, and #415 of 435 in Office.

Installs
129
Downloads
1.2K
Stars
-
Overall Rank
#4,936
Top 98% overall · Top 96% in Office
PlatformInstallsDownloadsStarsComments
SkillHub ↗1291.2K-—

Platforms count differently and update at different times.

What this skill does

The skill converts DOCX files to Markdown and can preserve headings, bold text, and lists. DOC and WPS files require WPS Office COM automation on Windows to convert them to DOCX first. Batch conversion can preserve subdirectory structure. Confirm the input scope, output directory, and required conversion environment before running, especially the Windows/WPS dependency for legacy formats.

Profile published 2026-10-29

What you can do with it

  • Convert a single DOCX file to Markdown
  • Batch-convert DOC, DOCX, or WPS documents
  • Preserve subdirectory structure in batch output

When to use it

  • The user asks to convert Word or WPS files to Markdown
  • Input formats and output location are confirmed
  • The required mammoth or Windows/WPS conversion environment is available

Example prompts

Generated from the skill’s documentation as examples; not results of actual runs.

Convert the DOCX files in this folder to Markdown in batch while preserving subdirectories. First list the files to process and the output directory.

Monthly Trend

Downloads1.2K
26461.3K2026-03 · Downloads 912026-05 · Downloads 4342026-06 · Downloads 5802026-07 · Downloads 8202026-08 · Downloads 9522026-09 · Downloads 1.2K26-0326-09
Stars-
0112026-03 · Stars -2026-05 · Stars -2026-06 · Stars -2026-07 · Stars -2026-08 · Stars -2026-09 · Stars -26-0326-09

The counting method changed in 2026-09: skills with the same name are now counted separately by author, and the full catalog is covered. Dashed lines show months before the change; they are not compared with later months, and no growth is computed across the change.

MonthDownloadsMoMStars
2026-091.2K—-
2026-08952+16.1%-
2026-07820+41.4%-
2026-06580+33.6%-
2026-05434—-
2026-0391—-

SKILL.md (original)

The author’s original file, shown as plain text without edits or review by AlphaMoat. Links are not clickable; check commands before running them. Fetched 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.
Show all (130 lines)
---

# 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

Popular in Office

Data month: 2026-09 · Downloads, stars and installs are aggregated monthly from public skill registries (ClawHub, SkillHub). See methodology.