OliverBalfour / obsidian-pandoc

Pandoc document export plugin for Obsidian (https://obsidian.md)
MIT License
713 stars 59 forks source link

[BUG] Unknown option --metadata-file #74

Open fglo opened 3 years ago

fglo commented 3 years ago

When I try to export a note obsidian-pandoc return an error: Pandoc export failed: Unknown option --metadata-file. Try pandoc --help for more information.

image

Easy fix is to comment this lines in main.js but it's not ideal:

if (input.metadataFile)
        args.push('--metadata-file', input.metadataFile);

I work o Windows 10 pandoc --version output:

pandoc 2.2.3.2
Compiled with pandoc-types 1.17.5.1, texmath 0.11.0.1, skylighting 0.7.2
Default user data directory: C:\Users\user\AppData\Roaming\pandoc
Copyright (C) 2006-2018 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
lukeaust commented 2 years ago

Simple but very effective

Koala commented 1 year ago

The --metadata-file option is only available as of Pandoc version 2.3 (2018-09-16): https://pandoc.org/releases.html#pandoc-2.3-2018-09-16

Add --metadata-file option (Mauro Bieg, #1960), which allows users to specify metadata in a YAML file, regardless of the input format (#1960).

This error message problem can be considered fixed only by checking if Pandoc can be used in version 2.3 or higher.


It took me a few hours to get to the root cause. So that this doesn't happen to others, this note should be included on the troubleshooting page: https://github.com/OliverBalfour/obsidian-pandoc/wiki/Troubleshooting


My version: pandoc 2.2.1 Debian 10

tonypeng1 commented 2 weeks ago

I got the same error. The issue was resolved by changing the Pandoc Plugin setting "Export files from HTML or markdown?" from HTML to markdown.

image

tonypeng1 commented 2 weeks ago

Another way is to select all content in a note, copy it, and directly paste to a new Word document. The results appear good.