gd2md-html icon indicating copy to clipboard operation
gd2md-html copied to clipboard

End tags incorrectly placed when list is in a table cell

Open andrewlayman opened this issue 3 years ago • 1 comments

For a table such as this, when converted to HTML, the closing </li> and </ul> tags are output just prior to the end of the cell, (/td>), rather than at the end of the list. (This causes me about 30 minutes of work each week fixing the formatting of large tables of lists.)

image

Expected output

<!-- Output copied to clipboard! -->

<!-- Yay, no errors, warnings, or alerts! -->


<table>
  <tr>
   <td>
<h3>Column 1, row 1</h3>


   </td>
   <td>
<h3>Heading A</h3>


<ul>

<li>A

<li>B

<li>C
</li>
</ul>

<h3>Heading B</h3>


<ul>

<li>D

<li>E

<li>F
</li>
</ul>
   </td>
  </tr>
  <tr>
   <td>
<h3>Column 1, row 1</h3>


   </td>
   <td>
<h3>Heading A</h3>


<ul>

<li>A 
<ul>
 
<li>A1
 
<li>A2
</li> 
</ul>

<li>B

<li>C
</li>
</ul>
<h3>Heading B</h3>


<ul>

<li>D

<li>E

<li>F
</li>
</ul>
   </td>
  </tr>
</table>

Actual output:

<!-- Output copied to clipboard! -->

<!-- Yay, no errors, warnings, or alerts! -->


<table>
  <tr>
   <td>
<h3>Column 1, row 1</h3>


   </td>
   <td>
<h3>Heading A</h3>


<ul>

<li>A

<li>B

<li>C

<h3>Heading B</h3>


<ul>

<li>D

<li>E

<li>F
</li>
</ul>
</li>
</ul>
   </td>
  </tr>
  <tr>
   <td>
<h3>Column 1, row 1</h3>


   </td>
   <td>
<h3>Heading A</h3>


<ul>

<li>A 
<ul>
 
<li>A1
 
<li>A2
</li> 
</ul>

<li>B

<li>C

<h3>Heading B</h3>


<ul>

<li>D

<li>E

<li>F
</li>
</ul>
</li>
</ul>
   </td>
  </tr>
</table>

If rendered correctly, this would look like

image

but, instead, it looks like

image

andrewlayman avatar Nov 20 '22 17:11 andrewlayman

This is a known bug with HTML lists (https://github.com/evbacher/gd2md-html/issues/15). Markdown is the primary target for this add-on, but we do use HTML for tables, so I'd like to fix it when I get some time. I've tinkered with it a few times and broken a bunch of other stuff :( But I'll try again -- no promises on a delivery date though.

evbacher avatar Feb 08 '23 21:02 evbacher