Pandoc:将Markdown转换为HTML *没有任何HTML属性

gli*_*orm 4 html markdown converters pandoc

是否有一种方法可以告诉Pandoc将Markdown转换为HTML,从而仅生成没有任何属性/类的纯HTML标记?

例:

当前的Pandoc输出

<pre class="sourceCode bash">
  <code class="sourceCode bash">
      TEXT
  </code>
</pre>
Run Code Online (Sandbox Code Playgroud)

所需的Pandoc输出

<pre>
  <code>
      TEXT
  </code>
</pre>
Run Code Online (Sandbox Code Playgroud)

我浏览了官方文档,但没有找到任何选择。

谢谢!

tar*_*leb 6

没有内置选项,但是您可以使用简单的过滤器删除所有属性和类。将以下内容保存到文件中,remove-attr.lua然后使用调用pandoc --lua-filter=remove-attr.lua

function remove_attr (x)
  if x.attr then
    x.attr = pandoc.Attr()
    return x
  end
end

return {{Inline = remove_attr, Block = remove_attr}}
Run Code Online (Sandbox Code Playgroud)