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-themesto 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
convertsends 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