frank.b
frank.b

Reputation: 23

Pandoc 1.13.2 outputs html table as text

Take this tst.md file (in Markdown)

% Test document

<table>
    <thead>
        <tr >
            <th>A</td>
            <th>B</td>
        </tr>
    </thead>
    <tbody>
        <tr >
            <td>1</td>
            <td>2</td>
        </tr>
        <tr >
            <td>3</td>
            <td>4</td>
        </tr>
    </tbody>
</table>

End of test file

and run it with pandoc 1.13.2 to transform it into html

pandoc -s "test.md" -o test.html

The created test.html contains

<table>
<pre><code>&lt;thead&gt;
  &lt;tr &gt;
    &lt;th&gt;A&lt;/td&gt;
    &lt;th&gt;B&lt;/td&gt;
  &lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
 &lt;tr &gt;
    &lt;td&gt;1&lt;/td&gt;
    &lt;td&gt;2&lt;/td&gt;
  &lt;/tr&gt;
 &lt;tr &gt;
    &lt;td&gt;3&lt;/td&gt;
    &lt;td&gt;4&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;</code></pre>
</table>

A <pre><code> tag is inserted after <table>. The following html code is encoded and displays as code not as a table.

The pandoc website says: Standard markdown allows you to include HTML “blocks”: blocks of HTML between balanced tags that are separated from the surrounding text with blank lines, and start and end at the left margin. Within these blocks, everything is interpreted as HTML, not markdown;

The same result comes out if you do on Pandoc's trial site http://johnmacfarlane.net/pandoc/try

The older version 1.11.1 worked fine. But 1.11.1 is no longer available on Pandoc's website (as a MSI installer).

What did I do wrong ?

Upvotes: 1

Views: 2581

Answers (2)

Chris
Chris

Reputation: 137268

You reference the section for the markdown_in_html_blocks extension, which is clearly says that Pandoc Markdown doesn't behave this way by default:

Pandoc behaves this way when the markdown_strict format is used; but by default, pandoc interprets material between HTML block tags as markdown.

Use the strict input format by adding -f markdown_strict to your command.

Upvotes: 2

frank.b
frank.b

Reputation: 23

Tried it with all tags to the left (no indentation) which works on the trial site and with pandoc 1.13.2. It seems that pandoc 1.13.2 requires total absence indentation in raw html where as in previous versions html would stay raw if the first (and last) tag had no spaces or tab before.

Upvotes: 1

Related Questions