Bruce Korn
Bruce Korn

Reputation: 71

Pandoc HTML to Markdown - Non-Html tables

I use the following Pandoc command to convert HTML to Markdown

pandoc -f html -t commonmark myfile.html >myfile.md

It works great but for some reason it always converts a table to an html coded table rather than a "markdown" table (with no html tags in it). Does anyone know how I can force Pandoc to produce a non-html coded table?

Upvotes: 6

Views: 6195

Answers (1)

vv01f
vv01f

Reputation: 372

that is perfectly ok because you defined commonmark for output, simply because the original markdown did not have tables and everything there was not already was adviced to do in the surrounding language. that is html in this case.

read https://daringfireball.net/projects/markdown/syntax and you will see html is allowd within markdown.

to achieve the extended markdown output as mentioned in the pandoc manual: pandoc -f html -t markdown myfile.html >myfile.md works here

result:

  --- --- ---
  1   2   3
  1   2   3
  --- --- ---

myfile.html:

<html><body>

<table>
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>1</td><td>2</td><td>3</td></tr>
</table>

</body></html>

Upvotes: 3

Related Questions