Pandoc过滤器tikz.py返回“不是有效的json值”

时间:2021-11-24 00:07:28

I'm using the tikz.py pandocfilter to turn latex tikz code in a markdown file into images in the output html file. I'm running pandoc version 1.17.0.2, python 2.7.10 and ImageMagick 6.9.6-4. My pandoc command is:

我正在使用tikz.py pandocfilter将markdown文件中的latex tikz代码转换为输出html文件中的图像。我正在运行pandoc版本1.17.0.2,python 2.7.10和ImageMagick 6.9.6-4。我的pandoc命令是:

pandoc -s -c --mathjax -i- t slidy tik.md --filter tikz.py -o tik.html

(but I've tried simpler commands without slidy or mathjax and they give the same issue)

(但我尝试过没有滑动或mathjax的更简单的命令,他们给出了同样的问题)

Where tik.md contains a simple tikz environment:

其中tik.md包含一个简单的tikz环境:

\begin{tikzpicture}
\draw (0,0) -- (4,0) -- (4,4) -- (0,4) -- (0,0);
\end{tikzpicture}

tikz.py runs well and it seems to successfully generate the image:

tikz.py运行良好,它似乎成功生成图像:

$ pandoc -s -c --mathjax -i -t slidy tik.md --filter tikz.py -o tik.html

$ pandoc -s -c --mathjax -i -t slidy tik.md --filter tikz.py -o tik.html

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex) restricted \write18 enabled.

这是pdfTeX,版本3.14159265-2.6-1.40.16(TeX Live 2015)(预加载格式= pdflatex)启用了限制\ write18。

entering extended mode

进入扩展模式

(./tikz.tex

LaTeX2e <2015/01/01>

Babel ...

.....

[1] (./tikz.aux) )

[1](./tikz.aux))

Output written on tikz.pdf (1 page, 1077 bytes).

输出写在tikz.pdf上(1页,1077字节)。

Transcript written on tikz.log.

在tikz.log上写的成绩单。

Created image tikz-images/53200b26dfa2c05d2b92647ef74211f7a2ce0c0e.png

创建的图像tikz-images / 53200b26dfa2c05d2b92647ef74211f7a2ce0c0e.png

pandoc: Error in $: Failed reading: not a valid json value

pandoc:$中的错误:读取失败:不是有效的json值

I am using an unaltered tikz.py so it is not clear to me where the source of the problem could be. Any thoughts?

我正在使用一个未改变的tikz.py所以我不清楚问题的根源在哪里。有什么想法吗?

1 个解决方案

#1


1  

I just ran into the same thing in a Ruby filter, and finally figured out that it was because I was trying to write debugging output to standard output. Since a filter has to read standard input and write to standard output, any debugging output on standard output will blow things up.

我刚刚在Ruby过滤器中遇到了同样的事情,最后发现它是因为我试图将调试输出写入标准输出。由于滤波器必须读取标准输入并写入标准输出,因此标准输出上的任何调试输出都会破坏。

In my Ruby filter I had to change puts 'debug stuff' to STDERR.puts 'debug stuff'.

在我的Ruby过滤器中,我不得不将put'debug stuff'更改为STDERR.puts'debug stuff'。

#1


1  

I just ran into the same thing in a Ruby filter, and finally figured out that it was because I was trying to write debugging output to standard output. Since a filter has to read standard input and write to standard output, any debugging output on standard output will blow things up.

我刚刚在Ruby过滤器中遇到了同样的事情,最后发现它是因为我试图将调试输出写入标准输出。由于滤波器必须读取标准输入并写入标准输出,因此标准输出上的任何调试输出都会破坏。

In my Ruby filter I had to change puts 'debug stuff' to STDERR.puts 'debug stuff'.

在我的Ruby过滤器中,我不得不将put'debug stuff'更改为STDERR.puts'debug stuff'。