php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

First TD in table removes the first p tag.

Open Tomas-Zeitguys opened this issue 10 years ago • 0 comments

The issue seems to happen with the "transform" function. The first <p> tag in the first <td> in a table gets removed. Here is an example of the problem (using allowed html).

INPUT

<table>
    <thead>
        <tr>
            <th></th>
            <th>aaa</th>
            <th>bbb</th>
            <th>ccc</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>Something</th>
            <td>
                <p>1</p>
                <p style="text-align: right">a</p>
            </td>
            <td><p>29</p><p style="text-align: left">b</p></td>
            <td><p>30</p><p style="text-align: left">a + b</p></td>
        </tr>
        <tr>
            <th>Something 2</th>
            <td><p>9</p><p style="text-align: right">c</p></td>
            <td><p>21</p><p style="text-align: left">d</p></td>
            <td><p>30</p><p style="text-align: left">c + d</p></td>
        </tr>
    </tbody>
</table>

OUTPUT

<table>
    <thead>
        <tr>
            <th></th>
            <th>aaa</th>
            <th>bbb</th>
            <th>ccc</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>Something</th>
            <td>
                1
                <p style="text-align: right">a</p>
            </td>
            <td><p>29</p><p style="text-align: left">b</p></td>
            <td><p>30</p><p style="text-align: left">a + b</p></td>
        </tr>
        <tr>
            <th>Something 2</th>
            <td><p>9</p><p style="text-align: right">c</p></td>
            <td><p>21</p><p style="text-align: left">d</p></td>
            <td><p>30</p><p style="text-align: left">c + d</p></td>
        </tr>
    </tbody>
</table>

This also happens for the first paragraph in <li> within a <ol> or <ul>

Tomas-Zeitguys avatar Apr 07 '15 21:04 Tomas-Zeitguys