shd101wyy / vscode-markdown-preview-enhanced

One of the "BEST" markdown preview extensions for Visual Studio Code
https://shd101wyy.github.io/markdown-preview-enhanced
Other
1.45k stars 173 forks source link

filter in pandocArguments not working #474

Open mivanit opened 3 years ago

mivanit commented 3 years ago

I'm trying to get a pandoc filter (for rendering tikz to png) to work with the preview, but it doesn't appear to be working I've tested the filter using a command of the form

pandoc test.md -f markdown+raw_tex+raw_attribute+citations+tex_math_dollars --filter=pandoc_filter.py -o test.html

and it seems to work fine. However, when I set

"markdown-preview-enhanced.pandocMarkdownFlavor": "markdown+raw_tex+raw_attribute+citations+tex_math_dollars",
"markdown-preview-enhanced.pandocArguments": "--filter=F:\\path\\to\\pandoc_filter.py",
"markdown-preview-enhanced.usePandocParser": true,

the block of tikz still appears as a regular code block in the preview. I've even tried pre-rendering the image by running it through the command line (so that the filter would hash the TeX block and realize the image already exists), to no avail.

I did some digging and it looks like the pandocArguments config setting is not actually injected into the args in pandocConvert() -- is this being done somewhere else, or is this feature not yet implemented?

The weirdest thing is that if I specify an invalid path in the pandocArguments setting, I get an error message. So I guess this means they are being read? I just can't seem to figure out where, or why it's failing to execute the filter properly.

shd101wyy commented 3 years ago

It seems like "markdown-preview-enhanced.pandocArguments" should be a list? Maybe yours should be


"markdown-preview-enhanced.pandocArguments":
["--filter=F:\\Gdrive\\notes\\tools\\pandoc\\pandoc_filter.py"]

Thank you!

On Thu, Mar 25, 2021 at 10:41 AM mivanit @.***> wrote:

I'm trying to get a pandoc filter (for rendering tikz to png) to work with the preview, but it doesn't appear to be working I've tested the filter using a command of the form

pandoc test.md -f markdown+raw_tex+raw_attribute+citations+tex_math_dollars --filter=pandoc_filter.py -o test.html

and it seems to work fine. However, when I set

"markdown-preview-enhanced.pandocMarkdownFlavor": "markdown+raw_tex+raw_attribute+citations+tex_math_dollars","markdown-preview-enhanced.pandocArguments": "--filter=F:\Gdrive\notes\tools\pandoc\pandoc_filter.py","markdown-preview-enhanced.usePandocParser": true,

the block of tikz still appears as a regular code block in the preview. I've even tried pre-rendering the image by running it through the command line (so that the filter would hash the TeX block and realize the image already exists), to no avail.

I did some digging and it looks like the pandocArguments config setting is not actually injected into the args in pandocConvert() -- is this being done somewhere else, or is this feature not yet implemented?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shd101wyy/vscode-markdown-preview-enhanced/issues/474, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOSA72EU4F2LLFEL6UAV7DTFKPHNANCNFSM4ZYO7HJQ .

mivanit commented 3 years ago

Unfortunately that does not seem to fix it :( image adding a second flag to the pandoc arguments (comma separated, --verbose) doesn't change much either

shd101wyy commented 3 years ago

Might be a bug. I will investigate more. Thank you!