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

Improved support of TABLE

Open guyplusplus opened this issue 4 years ago • 6 comments

  • migrated to node v5
  • upgraded inclusion of turndown npm package to 7.0.0
  • support tables with caption and colgroup elements
  • support conversion of a multi-lines cell to a single line cell
  • support pipe character | escape in a table cell
  • fix support for tables with no row
  • support for colspan
  • nested table inside a table render as is, gfm is not applied
  • added more test cases accordingly

guyplusplus avatar Apr 21 '21 14:04 guyplusplus

Thank you so much! These changes really helped me a lot!!

ct1735x avatar Jun 18 '21 08:06 ct1735x

NPM package created until pull request is approved (and maintained) https://www.npmjs.com/package/@guyplusplus/turndown-plugin-gfm

guyplusplus avatar Jun 26 '21 08:06 guyplusplus

NPM package created until pull request is approved (and maintained) https://www.npmjs.com/package/@guyplusplus/turndown-plugin-gfm

That's great. Maybe you can also point this PR to the other maintained fork? I'm sure that @laurent22 would be more than happy to accept your PR (and maybe even some maintenance help).

This way, users won't be struggling which fork should be used.

alexanderadam avatar Jun 27 '21 10:06 alexanderadam

In fact we now publish two packages, which are used by the Joplin apps, but are generic enough that they should work in any environment:

https://www.npmjs.com/package/@joplin/turndown

https://www.npmjs.com/package/@joplin/turndown-plugin-gfm

Code is still MIT, and available there:

https://github.com/laurent22/joplin/tree/dev/packages/turndown

https://github.com/laurent22/joplin/tree/dev/packages/turndown-plugin-gfm

laurent22 avatar Jun 27 '21 10:06 laurent22

Sounds a good plan, especially after the dependencies to Joplin in the package have been removed couple weeks ago (reason why I did create my own fork).

Just couple things:

  • right now the package is a directory part of a bigger project, better split so that the npm package / repo can have its own life
  • this package shall follow closely the turndown new releases

I plan to add the following new features, to be discussed if makes sense and on the details:

  • support rowspan to generate a pure MD table (with empty cells)
  • add a new output option for "No HTML" so that HTML is not included nor generated in the output. In particular for tables where gfm is quite limited. Joplin can opt-out. When enabling it, it would mean no
    nor HTML nested table, which would be replaced as an ugly long line...

@laurent22 what do you think?

guyplusplus avatar Jul 11 '21 01:07 guyplusplus

For information, our Turndown plugins are now part of the official Joplin repository:

https://github.com/laurent22/joplin/tree/dev/packages/turndown

https://github.com/laurent22/joplin/tree/dev/packages/turndown-plugin-gfm

They are both still maintained and under the same MIT license. We accept pull requests.

laurent22 avatar Apr 09 '22 11:04 laurent22