Custom word template with Pandoc pluugin

Things I have tried

What I’m trying to do

I’m using this plugin GitHub - OliverBalfour/obsidian-pandoc: Pandoc document export plugin for Obsidian ( and trying to use custom reference word file.

In plugin settings in Extra Pandoc arguments I set:

–reference-doc Users/lars/Documents/myref.docx

but export on start failed because of error: file doesn’t exist

Any clues how to fix it?

I guess that’s because you have to put your template in the pandoc template path, see here.

unfortunately doesn’t work, copied custom-reference.docx to Pandoc path and /templates

then used:
–reference-doc “/custom-reference.docx”
–reference-doc “custom-reference.docx”

no effect

This is not what the documentation says. I haven’t used that feature, so I am not talking from experience, but following the documentation, the Extra Pandoc arguments setting should be filled with --template custom-reference .

Documentation says if you want to use word-template, you should use --reference-doc:

–reference-doc=FILE Use the specified file as a style reference in producing a docx or ODT file.

For sanity check I’ve tried --template, it doesn’t work

I am not talking of the pandoc manual, but the plugin documentation I linked to in my previous post.

Could you share a screenshot of your plugin settings?

I understand, but plugin is just a wrap for pandoc and uses the same command lines, I guess.

Here is my settings:

My guess - an error connected with working directory of Pandoc. If I use:

which pandoc it gives dir, where Pandoc is. And this dir is set in settings. But if I use pandoc --version, it says:

Default user data directory: /Users/karnanoid/.local/share/pandoc or /Users/karnanoid/.pandoc

And I can’t see such directories

But you didn’t do what I recommended above! Put only --template custom-reference in the “Extra pandoc arguments”. No .docx or whatever else!

If this doesn’t help as well, try to leave the “Pandoc path” field empty and see if that changes anything - usually when pandoc is installed, obsidian should discover the right path automatically! (Maybe restart obsidian after emptying the field…)

In general: if you are looking for help here, you should follow the solutions proposed or just follow the plugin’s documentation… To be honest, it is a waste of time for everybody trying to help here if you don’t follow their propositions, do something else instead and then state that it is not working…

After emptying path Obsidian says - can’t find Pandoc, plugin functionality is restricted

My apologies!)) after --template custom-reference error says can’t find file in templates/custom-reference.docx. But I have templates/custom-reference.docx in Pandoc Path. Stuck( Maybe somewhere should be another working or user directory?

Thank you for your help!

Well, then maybe this is because, as you stated, the plugin can’t find the right template path… I guess you are on Mac? I have no experiences with Mac OS, but as far as I know the plugin on MAC should search in a hidden folder (within your home directory) named .pandoc/templates. Let’s try to figure this out step by step (maybe you already followed some of these steps - if so, ignore them; but just for reassuring ourselves that everything is configured in the right way!):

  1. Refill the “Pandoc path” in the plugin’s settings with the output of “which pandoc” in your terminal.
  2. Check if the folder ~/.pandoc/templates exists - if not, create it (don’t forget the . in front of the folder name!)
  3. If it exists or after creating, put your “custom-reference.docx” file in this “.pandoc/templates” folder.
  4. Try in obsidian if that solves the problem (maybe restart obsidian before).
  5. If that doesn’t help, add the “docx” ending in the Extra pandoc arguments (but nothing else): --template custom-reference.docx
  6. If that still doesn’t help, check if there is any error message in obsidian’s inspect tool and post a screenshot.

i’ve made .pandoc/templates in Pandoc path directory - doesn’t work. Then i’ve made .pandoc/templates in users root directory, after that i have:

Снимок экрана 2022-08-12 в 15.50.37

Any updates on this topic?
I’m also trying to use pandoc to export a docx, but get the same result.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.