-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pandoc errors when full filter path is not specified. #3458
Comments
Pandoc definitely still works with filters that are
in your PATH, even if the path is not specified.
I use pandoc with a number of filters every day.
I suspect you have some other problem, perhaps
Windows related. I suppose it's possible that the way your
PATH is set in the terminal doesn't persist to the
subprocess pandoc starts. The environment should
be inherited from the calling process, but maybe
this works differently on Windows?
If you installed pandoc with the binary package, then
you should have pandoc-citeproc installed in your path.
So you could always try with that. If that works, then
the problem is not that pandoc doesn't find filters in
its path; it's something more specific to your setup.
+++ Raghu [Feb 20 17 08:34 ]:
… Looks like this is something that's broken recently (used to work with
1.16 & 1.17)
Pandoc version -
D:\code\easyblogger>pandoc --version
pandoc 1.19.1
I have a pandoc filter called mermaid-filter which is installed with
npm install -g raghur/mermaid-filter
D:\code\easyblogger\assets>which mermaid-filter.cmd
C:\Users\raghuramanr\AppData\Roaming\npm\mermaid-filter.cmd
This used to work - but now doesnt:
D:\code\easyblogger\assets>pandoc -t html -i test.md -F mermaid-filter.cmd
module.js:472
throw err;
^
Error: Cannot find module 'D:\code\easyblogger\assets\node_modules\mermaid-filte
r\index.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
pandoc: Error running filter mermaid-filter.cmd
Filter returned error status 1
when called as a filter with just the cmd file, it cannot find
node_modules correctly. Replacing with full path to the filter in the
command above makes it succeed but isn't ideal..
Also this works as well (just to emphasize that I have a sane env)
D:\code\easyblogger\assets>pandoc -t json -i test.md | mermaid-filter.cmd
We're really sorry, but anonymous uploading in your country has been disabled. P
lease <a href="/register">register for an account</a> and try uploading again. (
img\diagram-2.png)
{"pandoc-api-version":[1,17,0,4],"meta":{},"blocks":[{"t":"Header","c":[1,["this
-is-a-test-file",[],[]],[{"t":"Str","c":"This"},{"t":"Space"},{"t":"Str","c":"is
"},{"t":"Space"},{"t":"Str","c":"a"},{"t":"Space"},{"t":"Str","c":"test"},{"t":"
Space"},{"t":"Str","c":"file"}]]},{"t":"Para","c":[{"t":"Image","c":[["",[],[]],
[],["",""]]}]},{"t":"Para","c":[{"t":"Str","c":"This"},{"t":"Space"},{"t":"Str",
"c":"should"},{"t":"Space"},{"t":"Str","c":"get"},{"t":"Space"},{"t":"Str","c":"
converted"}]}]}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, [1]view it on GitHub, or [2]mute the
thread.
References
1. #3458
2. https://github.com/notifications/unsubscribe-auth/AAAL5MYzmZtQ__0bxo_W595I6YGwGT05ks5recCzgaJpZM4MGZBC
|
THe generated cmd file uses Definitely not a pandoc issue - but I wonder if this is something in how windows behaves :(
|
So fixed at my end by modifying the generated cmd file to use
|
Good, I'm glad there's a workaround, documented here!
|
Hopefully editing the globally installed .cmd file isn't the long term fix! |
I agree - it's ugly... it's however the only thing that worked for me.... Also have to redo it every time the npm package is upgraded/reinstalled |
I'm not a Windows guy either, but if you guys know how to fix this for windows, suggestions are welcome... |
Maybe it is possible to have a postinstall script in the mermaid-filter package that overwrite the cmd file with the monkey-patched version if the install target is Windows? Just a thought. |
The following PowerShell could be used as a post install script: $Path = "$env:APPDATA\npm\mermaid-filter.cmd"
$Content = (Get-Content $Path ).Replace('node "%~dp0','node "%~dp$PATH:0')
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($Path, $Content, $Utf8NoBomEncoding) |
my solution is "pass to wsl". Write pandoc ./input.md --from=markdown --to=docx --standalone -F $HOME/.volta/bin/mermaid-filter --reference-doc=./template.docx --output=./output.docx Next, run this command wsl.exe -d arch -- ./publish.sh In command passing, passed command is executes in If you do exactly the same as me, as a prerequisite, volta and mermaid-filter must be installed in WSL2 Archlinux. wsl.exe -d arch -- volta install mermaid-filter |
Looks like this is something that's broken recently (used to work with 1.16 & 1.17)
Pandoc version -
I have a pandoc filter called mermaid-filter which is installed with
npm install -g raghur/mermaid-filter
This used to work - but now doesnt:
when called as a filter with just the cmd file, it cannot find node_modules correctly. Replacing with full path to the filter in the command above makes it succeed but isn't ideal..
Also this works as well (just to emphasize that I have a sane env)
The text was updated successfully, but these errors were encountered: