
Security News
RubyGems Adds Cooldown Feature to Bundler for Newly Published Gems
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.
md2docx-cli
Advanced tools
A powerful command-line tool for converting Markdown files to DOCX files using Pandoc. It simplifies the Pandoc workflow by providing predefined options, template management, and cross-platform support.
Install the package globally using npm:
npm install -g md2docx-cli
Upon installation, md2docx automatically performs the following setup tasks:
lib, filters, and custom directories.xlsx2md-cli, mmap2md-cli, mermaid-cli).If you need to manually mount components or re-run the setup:
md2docx-mount [options]
| Option | Description |
|---|---|
-v, --verbose | Show detailed log output |
The md2docx command utilizes a set of predefined Pandoc options and scripts to perform DOCX conversion.
md2docx [options] [--- [CONVERTER ARGUMENTS]]
| Option | Description | Default | Env |
|---|---|---|---|
-V, --version | Output the version number. | - | - |
-c, --converter-path <PATH> | Specify the path for the converter. | "pandoc" | MD2DOCX_CONVERTER_PATH |
--log-file <FILE> | Write log messages to a specified file. | - | - |
--log-filter <STREAM> | Filter the log file messages by STREAM. | "both" | - |
-h, --help | Display help for the command. | - | - |
| Argument | Description |
|---|---|
--- | Separator. All arguments after this are passed directly to Pandoc. |
CONVERTER ARGUMENTS | Input files and additional Pandoc options. |
Available when running on non-Windows platforms.
| Option | Description | Default | Env |
|---|---|---|---|
--bottle <NAME> | Specify a specific WINE bottle. When used, file paths in arguments are automatically converted from Windows to Unix format. | - | - |
-w, --wine-path <PATH> | Specify the path for WINE. | "wine" | MD2DOCX_WINE_PATH |
md2docx --- input.md -o output.docx
md2docx --- -f xlsx.lua -o test.docx test.xlsx
md2docx --- --reference-doc=template.docx --toc --toc-depth 3 input.md -o output.docx
md2docx --bottle my-bottle --- input.md -o output.docx
| Variable | Description | Default |
|---|---|---|
MD2DOCX_CONVERTER_PATH | Path to the Pandoc executable. | pandoc |
MD2DOCX_CONVERTER_DATA_DIR | Custom Pandoc user data directory. | Auto-detected |
MD2DOCX_CONVERTER_RESOURCE_PATH | Additional resource path for Pandoc. | None |
MD2DOCX_WINE_PATH | Path to the WINE executable. | wine |
MD2DOCX_NPM_PATH | Path to the NPM executable. | npm |
MD2DOCX_FORCE_INSTALL | Force installation during post-install. | true |
MD2DOCX_FORCE_UNINSTALL | Force uninstallation during cleanup. | false |
Use the MD2DOCX_CONVERTER_RESOURCE_PATH environment variable to specify additional resource paths
for Pandoc. This automatically adds the --resource-path option to the Pandoc command.
export MD2DOCX_CONVERTER_RESOURCE_PATH=/path/to/resources
md2docx --- input.md -o output.docx
Use --log-file to write logs to a specific file:
md2docx --log-file ./conversion.log --- input.md -o output.docx
Filter which streams are captured in the log file:
# Log both stdout and stderr (default)
md2docx --log-file ./log.txt --log-filter both --- input.md -o output.docx
# Log only stdout
md2docx --log-file ./log.txt --log-filter stdout --- input.md -o output.docx
# Log only stderr
md2docx --log-file ./log.txt --log-filter stderr --- input.md -o output.docx
For scenarios where md2docx needs to be used within a WINE bottle environment, you can create a script link to
call the md2docx tool installed on the host environment from within the WINE bottle.
The md2docx-link command manages the md2docx link within WINE bottles.
md2docx-link [options] <BOTTLE>
| Parameter | Type | Description | Default | Env |
|---|---|---|---|---|
BOTTLE | Argument | Specify a WINE bottle. | - | - |
-V, --version | Option | Output the version number. | - | - |
-w, --wine-path <PATH> | Option | Specify the path for WINE. | "wine" | MD2DOCX_WINE_PATH |
-u, --unlink | Option | Remove the link. | - | - |
-t, --target <PATH> | Option | Specify the link PATH. | "C:\\windows\\system32\\md2docx.exe" | - |
-h, --help | Option | Display help for the command. | - | - |
md2docx-link my-bottle
md2docx-link --unlink my-bottle
md2docx-link --target "C:\\Program Files\\md2docx\\md2docx.exe" my-bottle
Pandoc uses reference documents as templates to format DOCX outputs. To manage multiple templates, md2docx
provides an npm-based solution. In this context, a package used for packaging templates is referred to as an optional
package. These packages can be managed using the md2docx-pm command.
Users first install the optional package using npm, and then manage the activation of templates by mounting or
unmounting them with md2docx-pm.
md2docx-pm [options] [command]
| Option | Description | Default | Env |
|---|---|---|---|
-V, --version | Output the version number. | - | - |
-c, --converter-path <PATH> | Specify the path for the converter. | "pandoc" | MD2DOCX_CONVERTER_PATH |
-n, --npm-path <PATH> | Specify the path for NPM. | "npm" | MD2DOCX_NPM_PATH |
-v, --verbose | Show the details log. | - | - |
-h, --help | Display help for the command. | - | - |
| Command | Description |
|---|---|
list | ls | List all optional packages. |
mount [options] [packages...] | Mount the specified optional packages, or all if none are specified. |
unmount [options] [packages...] | Unmount the specified optional packages, or all if none are specified. |
clean [options] | Remove all unmanaged template files. |
repair [options] [packages...] | Repair the specified optional packages, or all if none are specified. |
help [command] | Display help for a specific command. |
| Command | Option | Description |
|---|---|---|
mount | unmount | repair | -g, --global | Operate in global scope. |
clean | --backup <FOLDER> | Move unmanaged template files to the specified folder. |
md2docx-pm list
md2docx-pm mount template-package-name1 template-package-name2
md2docx-pm mount
md2docx-pm unmount package-name1
md2docx-pm repair package-name
md2docx-pm clean
md2docx-pm clean --backup ./template-backup
md2docx-pm mount -g template-package-name
To create a custom template package:
Create a package with the following package.json configuration:
{
"name": "my-custom-template",
"version": "1.0.0",
"config": {
"md2docx_package_type": "template"
}
}
Add template files to a templates folder:
.docx files for reference documents..md files for metadata templates.Install the package globally or locally:
npm install -g my-custom-template
Mount the package:
md2docx-pm mount -g my-custom-template
To remove all installed components without uninstalling the package:
md2docx-unmount [options]
| Option | Description |
|---|---|
-v, --verbose | Show detailed log output |
To completely remove md2docx and clean up the Pandoc user data folder:
Run md2docx-unmount to clean the directory:
md2docx-unmount
Uninstall the npm package:
npm uninstall -g md2docx-cli
If the md2docx files within the Pandoc user data folder become corrupted:
Attempt to restore files to their original state:
md2docx-mount
For specific template packages:
md2docx-pm repair package-name
| Code | Description |
|---|---|
0 | Success. |
-400 | Configuration error (e.g., package info not found). |
-500 | Execution error (e.g., Pandoc execution failed, process aborted). |
MIT.
FAQs
The command line tool for converting Markdown files to DOCX files using Pandoc.
The npm package md2docx-cli receives a total of 17 weekly downloads. As such, md2docx-cli popularity was classified as not popular.
We found that md2docx-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.