2016-03-04 25 views
7

Sono un principiante pandoc, quindi mi manca qualcosa di ovvio. Sto provando a convertire il file HTML generato da MS Word in markdown. Ecco un HTML di prova:Perché pandoc conserva tag span e div durante la conversione di html in markdown?

<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> 

e cerco di convertirlo con:

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

mi aspettavo "Oggi è una bella giornata", ma ho ottenuto:

<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> 

Perché il div è stato tenuto? Perché le campate sono state mantenute?

risposta

12

È necessario disattivare alcuni extensions. Sia sul lato di ingresso HTML:

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

O sul lato di uscita mark-down:

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