簡體   English   中英

為什么pandoc在將html轉換為markdown時會保留span和div標簽?

[英]Why pandoc keeps span and div tags when converting html to markdown?

我是一個pandoc新手,所以我必須遺漏一些明顯的東西。 我正在嘗試將MS Word生成的HTML文件轉換為markdown。 這是一個測試html:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title></title>
</head>
<body>
  <div class="Section1">
    <p class="Question"><span style="FONT-SIZE: 10pt">Today</span> <span style=
    "FONT-SIZE: 10pt">is</span> <span lang="HR" style=
    "FONT-SIZE: 10pt; mso-ansi-language: HR">a</span><span style=
    "FONT-SIZE: 10pt">nice</span> <span style="FONT-SIZE: 10pt">day</span> 
    </p>
  </div>
</body>
</html>

我嘗試將其轉換為:

pandoc -f html -t markdown test.html -o test.md

我期待“今天是美好的一天”,但得到了:

<div class="Section1">

<span style="FONT-SIZE: 10pt">Today</span> <span
style="FONT-SIZE: 10pt">is</span> <span lang="HR"
style="FONT-SIZE: 10pt; mso-ansi-language: HR">a</span><span
style="FONT-SIZE: 10pt">nice</span> <span
style="FONT-SIZE: 10pt">day</span>

</div>

為什么div保持不變? 為什么保持跨度?

您需要關閉一些擴展程序 在HTML輸入端:

$ pandoc -f html-native_divs-native_spans -t markdown test.html -o test.md

或者在減價輸出方面:

$ pandoc -f html -t markdown-raw_html-native_divs-native_spans-fenced_divs-bracketed_spans test.html -o test.md

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM