在带有过滤器的pandoc中添加地物元素

在带有过滤器的pandoc中添加地物元素,pandoc,Pandoc,我正在用python为pandoc编写一个过滤器。我正在使用pandocfilters 我想用图[InlineEl1,InlineEl2]替换段落[Image] pandoc不支持Figure,因此我使用RawBlock来编写原始html。问题是我不知道InlineEl1和InlineEl2的html。我需要让pandoc处理它们 可能的解决方法:使用Div,然后手动修改生成的html文件 有更好的方法吗 编辑:或者我可以将内联元素放入RawBlock?我现在只使用一个简单的字符串。我不知道这是

我正在用python为
pandoc
编写一个过滤器。我正在使用
pandocfilters

我想用
图[InlineEl1,InlineEl2]
替换
段落[Image]

pandoc
不支持
Figure
,因此我使用
RawBlock
来编写原始html。问题是我不知道
InlineEl1
InlineEl2
的html。我需要让
pandoc
处理它们

可能的解决方法:使用
Div
,然后手动修改生成的html文件

有更好的方法吗


编辑:或者我可以将内联元素放入
RawBlock
?我现在只使用一个简单的字符串。我不知道这是否可能,因为我没有任何可用的文档。我只是通过尝试和错误进行操作。

从Pandoc2.0开始,AST中的图形表示为。它只是一个只包含图像的段落,图像的
title
属性以
fig:
开头

$ echo '![caption](/url/of/image.png)' | pandoc -t native
[Para [Image ("",[],[]) [Str "caption"] ("/url/of/image.png","fig:")]]

$ echo '![caption](/url/of/image.png)' | pandoc -t html
<figure>
  <img src="/url/of/image.png" alt="caption" />
  <figcaption>caption</figcaption>
</figure>
$echo'![字幕](/url/of/image.png)| pandoc-t native
[Para[Image(“,[],[])[Str“caption”](“/url/of/Image.png”,“fig:”)]
$echo'![字幕](/url/of/image.png)| pandoc-t html
说明文字

参见

从pandoc 2.0开始,AST中的图形表示为。它只是一个只包含图像的段落,图像的
title
属性以
fig:
开头

$ echo '![caption](/url/of/image.png)' | pandoc -t native
[Para [Image ("",[],[]) [Str "caption"] ("/url/of/image.png","fig:")]]

$ echo '![caption](/url/of/image.png)' | pandoc -t html
<figure>
  <img src="/url/of/image.png" alt="caption" />
  <figcaption>caption</figcaption>
</figure>
$echo'![字幕](/url/of/image.png)| pandoc-t native
[Para[Image(“,[],[])[Str“caption”](“/url/of/Image.png”,“fig:”)]
$echo'![字幕](/url/of/image.png)| pandoc-t html
说明文字

请参见

对不起,我不清楚。我的目标是生成一个带有适当标记的html文件。我确信它没有,但那是因为我使用的是1.x版。尽管如此,还是有一个问题。我无法向figure添加属性。有办法吗?目前,HTML编写器只是将所有属性放在
上,很抱歉,我不清楚。我的目标是生成一个带有适当标记的html文件。我确信它没有,但那是因为我使用的是1.x版。尽管如此,还是有一个问题。我不能在图中添加属性。有办法吗?目前,HTML编写器只是将所有属性放在