doc2markdown
Document conversion assistant that automatically converts documents to Markdown (MD), saving output to the same directory as the source file. Designed to help intelligent agents read and process document content in various formats.
Quick Start
# Convert document (auto-polls for 60s, downloads if complete, returns doc ID if timeout)
node scripts/doc2markdown.js convert <file_path> # Downloads MD package
node scripts/doc2markdown.js convert <file_path> --md # Downloads single MD file
# Check status and download (for documents that exceeded timeout)
node scripts/doc2markdown.js check <doc_id> <original_file_path> # Downloads MD package
node scripts/doc2markdown.js check <doc_id> <original_file_path> --md # Downloads single MD file
Capabilities
- Supported formats: docx, doc, pdf, ppt, pptx, xls, xlsx, jpg, jpeg, png, ceb, teb, caj, odt, ofd, cebx, odp, ott, wps, ods, et, dps, epub, chm, sdc, sdd, sdw, mobi, etc.
- Preserves document structure, tables, and images
- API Key is optional, zero external dependencies. Without an API Key doc2markdown works exactly as before (anonymous upload); with one configured, the convert request is authenticated. See API Key (Optional)
- Downloaded ZIP files are extracted to
{doc_id}_{filename}/ under the source file's parent directory; single MD files are saved directly there
When to Use
- User requests to "read", "extract", "convert", or "view" a document
- User provides a document path and asks about its content
- User needs to summarize or analyze a document
- User needs to convert document content to Markdown package
Download Modes
This tool supports two download modes:
--md mode: Downloads a single merged MD file to the source file's parent directory. Images are not included
- MD package: Downloads and extracts a ZIP package to
{doc_id}_{filename}/ in the source file's parent directory. Includes image files and tables, tables are rendered in HTML format
Choosing the Right Mode
| User Intent |
Example Phrases |
Mode to Use |
| Read / view / analyze a document |
"read this file", "what's in this doc", "summarize this PDF" |
--md (single MD file) |
| Explicitly convert to MD |
"convert to MD", "export as markdown", "转成MD" |
MD package (default, no --md); use --md only if user specifically asks for a single file |
Workflow
convert — Convert Document
- Invoke file parsing service
- Auto-poll conversion status (up to 60 seconds)
- Completes within 60s → Auto-download to source file directory
- Exceeds 60s → Return doc ID for subsequent
check query
check — Query and Download
- Provide the previously returned doc ID
- Download if complete, otherwise continue polling for 60 seconds
- Prompt to retry later if still not complete
API Key (Optional)
An API Key is optional — without one, doc2markdown works normally as before.
Configuring an API Key
| Source |
Location |
| Environment variable |
DOCCHAIN_SKILLS_API_KEY |
| Skill config |
doc2markdown/scripts/config.json (field docchain_api_key) |
With an API Key configured
Conversions are processed with priority (fast lane).
Data & Privacy
convert uploads files to the docchain cloud service (lab.hjcloud.com) for parsing. Results are returned as a ZIP archive and extracted locally.
- All transfers use HTTPS encryption.
- Users should ensure that documents do not contain sensitive or confidential information unless they have verified the service's data handling practices.
- Service endpoint: https://lab.hjcloud.com/llmdoc
Feedback & Support
For parsing errors, format issues, or other problems, please submit an issue on GitHub:
https://github.com/wct-lab/docchain-skills
1---2name: doc2markdown3description: Lightweight document utility designed to convert files to Markdown (MD), built specifically for intelligent agents (e.g., OpenClaw, ClaudeCode) to read and process content. Requires no external dependencies and accurately preserves document structure and formatting. Supported formats include docx, doc, pdf, ppt, pptx, xls, xlsx, jpg, jpeg, png, ceb, teb, caj, odt, ofd, cebx, odp, ott, wps, ods, et, dps, epub, chm, sdc, sdd, sdw, mobi4---5# doc2markdown67Document conversion assistant that automatically converts documents to Markdown (MD), saving output to the same directory as the source file. Designed to help intelligent agents read and process document content in various formats.89## Quick Start1011```bash12# Convert document (auto-polls for 60s, downloads if complete, returns doc ID if timeout)13node scripts/doc2markdown.js convert <file_path> # Downloads MD package14node scripts/doc2markdown.js convert <file_path> --md # Downloads single MD file1516# Check status and download (for documents that exceeded timeout)17node scripts/doc2markdown.js check <doc_id> <original_file_path> # Downloads MD package18node scripts/doc2markdown.js check <doc_id> <original_file_path> --md # Downloads single MD file19```2021## Capabilities2223- Supported formats: docx, doc, pdf, ppt, pptx, xls, xlsx, jpg, jpeg, png, ceb, teb, caj, odt, ofd, cebx, odp, ott, wps, ods, et, dps, epub, chm, sdc, sdd, sdw, mobi, etc.24- Preserves document structure, tables, and images25- API Key is **optional**, zero external dependencies. Without an API Key doc2markdown works exactly as before (anonymous upload); with one configured, the convert request is authenticated. See [API Key (Optional)](#api-key-optional)26- Downloaded ZIP files are extracted to `{doc_id}_{filename}/` under the source file's parent directory; single MD files are saved directly there2728## When to Use2930- User requests to "read", "extract", "convert", or "view" a document31- User provides a document path and asks about its content32- User needs to summarize or analyze a document33- User needs to convert document content to Markdown package3435## Download Modes3637This tool supports two download modes:3839- **`--md` mode**: Downloads a single merged MD file to the source file's parent directory. Images are not included40- **MD package**: Downloads and extracts a ZIP package to `{doc_id}_{filename}/` in the source file's parent directory. Includes image files and tables, tables are rendered in HTML format4142### Choosing the Right Mode4344| User Intent | Example Phrases | Mode to Use |45|---|---|---|46| Read / view / analyze a document | "read this file", "what's in this doc", "summarize this PDF" | `--md` (single MD file) |47| Explicitly convert to MD | "convert to MD", "export as markdown", "转成MD" | MD package (default, no `--md`); use `--md` only if user specifically asks for a single file |4849## Workflow5051### convert — Convert Document521. Invoke file parsing service532. Auto-poll conversion status (up to 60 seconds)543. **Completes within 60s** → Auto-download to source file directory554. **Exceeds 60s** → Return doc ID for subsequent `check` query5657### check — Query and Download581. Provide the previously returned doc ID592. Download if complete, otherwise continue polling for 60 seconds603. Prompt to retry later if still not complete6162## API Key (Optional)6364An API Key is **optional** — without one, doc2markdown works normally as before.6566### Configuring an API Key6768| Source | Location |69|---|---|70| Environment variable | `DOCCHAIN_SKILLS_API_KEY` |71| Skill config | `doc2markdown/scripts/config.json` (field `docchain_api_key`) |7273### With an API Key configured7475Conversions are processed with **priority** (fast lane).7677## Data & Privacy7879- `convert` uploads files to the docchain cloud service (`lab.hjcloud.com`) for parsing. Results are returned as a ZIP archive and extracted locally.80- All transfers use HTTPS encryption.81- Users should ensure that documents do not contain sensitive or confidential information unless they have verified the service's data handling practices.82- Service endpoint: https://lab.hjcloud.com/llmdoc8384## Feedback & Support8586For parsing errors, format issues, or other problems, please submit an issue on GitHub:87https://github.com/wct-lab/docchain-skills