markdown2doc
Document conversion assistant that automatically converts Markdown (MD) files to PDF or DOCX format, saving output to the same directory as the source file.
Quick Start
# Convert markdown to PDF
node scripts/markdown2doc.js convert <file_path> pdf # Output: same_name.pdf
# Convert markdown to WORD
node scripts/markdown2doc.js convert <file_path> docx # Output: same_name.docx
# List available themes
node scripts/markdown2doc.js list-themes
# Convert markdown to WORD with a theme
node scripts/markdown2doc.js convert <file_path> docx --theme tech
Capabilities
- Supported output formats: PDF, DOCX
- Multiple template themes available (use
list-themes to see all options)
- Preserves markdown structure, headings, lists, tables, and code blocks
- Generates a navigable table of contents with heading hierarchy
- Embeds images referenced in the markdown into the output document, including both local images
- No API Key or account required, minimal external dependencies
- Output file is saved to the same directory as the source markdown file
Note on local images: To ensure local images are correctly embedded in the output document, image files must be located in the same directory as the markdown file, or in a subdirectory of it (e.g., ./images/photo.png). Images referenced via absolute paths or paths pointing outside the markdown file's directory will be skipped for security reasons.
When to Use
- User requests to "export", "convert", "generate PDF", "generate DOCX", "generate doc", "generate Word document" from markdown
- User provides a markdown file path and asks to convert it to PDF, DOCX, or doc
- User needs a printable or shareable version of a markdown document
- User asks to apply a specific style or theme when converting to DOCX
- User asks to list available template themes or wants to know what template themes are supported
Workflow
convert — Convert Markdown File
- Read markdown file content from specified path
- Scan markdown for local image references and collect image files
- Send markdown content to conversion service
- Receive converted file stream (PDF or DOCX)
- Save output file to source file's parent directory
Data & Privacy
convert sends both the markdown file content and all locally referenced image files to the docchain cloud service (lab.hjcloud.com) for processing.
- Any local image path referenced in the markdown (e.g.,
) will be read from disk and uploaded along with the markdown content.
- All transfers use HTTPS encryption.
- Users are responsible for ensuring that neither the markdown content nor any referenced image files contain sensitive, confidential, or proprietary information. Use of this skill constitutes acceptance of the data transmission described above.
- Service endpoint: https://lab.hjcloud.com/llmdoc
Feedback & Support
For conversion errors, format issues, or other problems, please submit an issue on GitHub:
https://github.com/wct-lab/docchain-skills
1---2name: markdown2doc3description: Lightweight document utility designed to convert Markdown (MD) files to PDF or DOCX format. Supports multiple template themes. Preserves document structure, heading hierarchy, embedded images. Requires no external dependencies.4---5# markdown2doc67Document conversion assistant that automatically converts Markdown (MD) files to PDF or DOCX format, saving output to the same directory as the source file.89## Quick Start1011```bash12# Convert markdown to PDF13node scripts/markdown2doc.js convert <file_path> pdf # Output: same_name.pdf14# Convert markdown to WORD15node scripts/markdown2doc.js convert <file_path> docx # Output: same_name.docx16# List available themes17node scripts/markdown2doc.js list-themes18# Convert markdown to WORD with a theme19node scripts/markdown2doc.js convert <file_path> docx --theme tech20```2122## Capabilities2324- Supported output formats: PDF, DOCX25- Multiple template themes available (use `list-themes` to see all options)26- Preserves markdown structure, headings, lists, tables, and code blocks27- Generates a navigable table of contents with heading hierarchy28- Embeds images referenced in the markdown into the output document, including both local images29- No API Key or account required, minimal external dependencies30- Output file is saved to the same directory as the source markdown file3132> **Note on local images:** To ensure local images are correctly embedded in the output document, image files must be located in the **same directory as the markdown file, or in a subdirectory** of it (e.g., `./images/photo.png`). Images referenced via absolute paths or paths pointing outside the markdown file's directory will be skipped for security reasons.3334## When to Use3536- User requests to "export", "convert", "generate PDF", "generate DOCX", "generate doc", "generate Word document" from markdown37- User provides a markdown file path and asks to convert it to PDF, DOCX, or doc38- User needs a printable or shareable version of a markdown document39- User asks to apply a specific style or theme when converting to DOCX40- User asks to list available template themes or wants to know what template themes are supported4142## Workflow4344### convert — Convert Markdown File45461. Read markdown file content from specified path472. Scan markdown for local image references and collect image files483. Send markdown content to conversion service494. Receive converted file stream (PDF or DOCX)505. Save output file to source file's parent directory5152## Data & Privacy5354- `convert` sends **both the markdown file content and all locally referenced image files** to the docchain cloud service (`lab.hjcloud.com`) for processing.55- Any local image path referenced in the markdown (e.g., ``) will be read from disk and uploaded along with the markdown content.56- All transfers use HTTPS encryption.57- **Users are responsible for ensuring that neither the markdown content nor any referenced image files contain sensitive, confidential, or proprietary information.** Use of this skill constitutes acceptance of the data transmission described above.58- Service endpoint: https://lab.hjcloud.com/llmdoc5960## Feedback & Support6162For conversion errors, format issues, or other problems, please submit an issue on GitHub:63https://github.com/wct-lab/docchain-skills