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

Elements in tables will brake markdown syntax

Open alexanderadam opened this issue 7 years ago • 5 comments

Thank you very much for turndown. It is very well done. I just found a small issue:

 <table>
  <tr>
    <th>Please no line break here:<div></div></th>
  </tr>
  <tr>
    <td>Oh no!<td>
  </tr>
</table>

should result in

| Please no line break here: |
| --- |
| Oh no! |

But I get

| Please no line break here:
 |
| --- |
| Oh no! |  |

instead.

Have a nice day! ☀️

alexanderadam avatar Jan 12 '18 11:01 alexanderadam

Similarly:

<table>
  <thead>
    <tr>
      <td>Heading 1</td>
      <td>Heading 2</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Foo</td>
      <td>
        <p>Bar</p>
      </td>
    </tr>
  </tbody>
</table>

becomes

| Heading 1 | Heading 2 |
| --- | --- |
| Foo |
Bar

 |

when it should be

| Heading 1 | Heading 2 |
| --- | --- |
| Foo | <p>Bar</p> |

hansy avatar Dec 05 '18 00:12 hansy

Hello,

When is this issue expected to be fixed ?

Thanks, GBB

bbgaurav avatar Dec 11 '18 07:12 bbgaurav

I'm afraid there is no scheduled fix at the moment. I recommend that you create a custom rule to handle your use-case

domchristie avatar Dec 11 '18 08:12 domchristie

I have a similar problem with tables.

postatum avatar Oct 01 '19 09:10 postatum

Is this repo still under development? Would love to see this fixed as adding elements like p instead of a table is very common.

philiprenich avatar Jul 16 '20 09:07 philiprenich