如何跳过在html上具有特定标签的元素进行降价转换?

时间:2018-11-03 16:25:33

标签: markdown pandoc html-parser

我不想将HTML中的某些特定元素转换为markdown转换。让我说我不想转换svg标签:

输入(html格式):

<p><strong>one-to-many</strong> – where the ‘many’ side can be <strong>zero or more</strong> (an optional relationship) or <strong>one or more</strong> (a mandatory relationship).</p>
<svg xmlns="http://www.w3.org/2000/svg" height="248" width="693" viewBox="-197 0 866.2499999999993 309.9999999999998">
        ...
</svg>

预期结果(降价格式):

**one-to-many** – where the ‘many’ side can be zero or more (an optional relationship) or one or more (a mandatory relationship).
<svg xmlns="http://www.w3.org/2000/svg" height="248" width="693" viewBox="-197 0 866.2499999999993 309.9999999999998">
...
</svg>

我可以使用HTML解析器提取所有特定元素,然后将文档转换为markdown,并在转换后将这些元素以所需的方式放入markdown文档中,但我想知道使用pandoc命令有什么办法吗?

1 个答案:

答案 0 :(得分:1)

您可以告诉Pandoc的HTML阅读器使用include the HTML

botium-cli

如果您还想自定义pandoc的行为,可以编写pandoc filter