turndown-plugin-gfm icon indicating copy to clipboard operation
turndown-plugin-gfm copied to clipboard

Table with "<colgroup>" is considered as without header

Open andrey-skl opened this issue 5 years ago • 4 comments
trafficstars

Scenario: try to convert table with colgroup:

<table>
   <colgroup><col /></colgroup>
    <tbody>
        <tr>
            <td>content</td>
        </tr>
         <tr>
            <td>content</td>
        </tr>
    </tbody>
</table>

Expected result: table is converted

Actual result: table kept as is.

This function seems to be adapted to handle this:


function isFirstTbody (element) {
  var previousSibling = element.previousSibling;
  return (
    element.nodeName === 'TBODY' && (
      !previousSibling ||
      /* check if previousSibling is colgroup here? */
      (
        previousSibling.nodeName === 'THEAD' &&
        /^\s*$/i.test(previousSibling.textContent)
      )
    )
  )
}

andrey-skl avatar Jan 17 '20 12:01 andrey-skl

Created a pull request #31 for this issue

guyplusplus avatar Apr 21 '21 14:04 guyplusplus

Created a pull request #31 for this issue

I don't want to be pessimistic but there are also other unmerged PRs that wanted to fix things since 2018. But there wasn't a single commit to this plugin since then. Therefore, if I may give an advice: you might consider switching to this fork and direct your PR over there instead.

alexanderadam avatar Apr 21 '21 18:04 alexanderadam

Thanks a lot. You are right. Seems redundant job I did there. Though table output not working 100% as I expect... I will further look at it.

guyplusplus avatar Apr 24 '21 04:04 guyplusplus

No worries. It's not really obvious. It would be great if this repo would at least be archived and get an entry stating that it's not maintained anymore. But I didn't even get a response to that. :wink:

alexanderadam avatar Apr 24 '21 07:04 alexanderadam