docx-highlight-extractlisted
Install: claude install-skill hsinhan-h/hh-claude-skills
# Docx Highlight Extract
Pull every paragraph/table-row marked with a given highlight color out of a
`.docx` spec document, preserving enough table/section context to render as
a real Markdown document — not a flat list of disconnected sentences.
## Step 1: Ask what to extract
If the user hasn't already given all three, ask:
1. **規格書檔名** — which `.docx` file (filename or path)?
2. **版本號** — which version does this extraction correspond to (e.g. `V3.2`)? Used for labeling and the output filename.
3. **螢光標註顏色** — which highlight color marks this version's changes (e.g. 黃色/yellow)?
## Step 2: Locate the file and unzip it
`.docx` is a zip container. Find the file (Glob for `*<name>*.docx` if the
exact path isn't given), then extract `word/document.xml` to a scratch
directory:
```bash
mkdir -p <scratch>/docx_extract
unzip -o -q "<path-to-docx>" -d <scratch>/docx_extract
```
If `unzip` isn't available, use PowerShell's `Expand-Archive` instead (it
works regardless of the `.docx` extension — it reads zip content, not the
name). Large spec docs commonly have a `document.xml` in the tens of MB —
that's normal, the bundled script handles it without a full DOM parse.
## Step 3: Run the extraction script
Map the user's color to a `w:highlight` value first — see the table in
[REFERENCE.md](REFERENCE.md). Then:
```bash
node scripts/extract-highlights.js <scratch>/docx_extract/word/document.xml <color> <scratch>/highlights.json
```
If it reports 0 matches, don't guess — re-check