Skip to content

Instantly share code, notes, and snippets.

@bitsgalore
Last active March 8, 2022 03:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bitsgalore/7c5da72277557b608c94 to your computer and use it in GitHub Desktop.
Save bitsgalore/7c5da72277557b608c94 to your computer and use it in GitHub Desktop.
Add Windows context menu items

Add Windows context menu to convert Markdown file to MS Word (docx)

Adapted from Adapted from Luke Maciak's Markdown Menus, which is described here (removed PDF option, which I never got to work anyway). Requires PanDoc. Install steps:

  1. Download markdown-to-docx-menu.reg file.
  2. Change path to pandoc.exe to your local Pandoc installation.
  3. Optionally you might want to fine-tune PanDoc's many in- and output options to you own needs as well.
  4. Save the file.
  5. In Windows explorer, right-click on reg file; select Merge and then confirm. All done!

If installation is successful, you can now convert any Markdown file to Word by right-clicking on it, and then click on mk2doc.

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\jpylyzer]
[HKEY_CLASSES_ROOT\*\shell\jpylyzer\command]
@="\"C:\\jpylyzer\\jpylyzer.exe\" \"%1\" > \"%1.xml\""
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\mkd2doc]
[HKEY_CLASSES_ROOT\*\shell\mkd2doc\command]
@="\"C:\\Users\\jkn010\\AppData\\Local\\Pandoc\\pandoc.exe\" -s -S --ascii -N --toc-depth=2 \"%1\" -o \"%1.docx\""
@bipbip404
Copy link

Hello,
That tried on Windows 10 but ...
After installing Pandoc and creating registry keys, clicking mkd2doc produces the following message:

This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel.

@Siardeni
Copy link

Hello,

I made my own reg file with SubCommands and it works very well. Thank you so much !
Just a little problem, for example with a file "myfile.txt" we will have "myfile.txt.docx". I can not find how to play with "%" to remove the original extension. Do you have any suggestions?

Nico

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT*\shell\Pandoc]
"MUIVerb"="&Pandoc"
"SubCommands"="Pandoc.2doc; Pandoc.2txt; Pandoc.2html; "

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2doc]
@="&2doc"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2doc\command]
@=""C:\Program Files (x86)\Pandoc\pandoc.exe" -s "%1" -o "%1.docx""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2txt]
@="&2txt"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2txt\command]
@=""C:\Program Files (x86)\Pandoc\pandoc.exe" -s "%1" -o "%1.txt""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2html]
@="&2html"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Pandoc.2html\command]
@=""C:\Program Files (x86)\Pandoc\pandoc.exe" -s "%1" -o "%1.html""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment