mixmark-io / turndown

🛏 An HTML to Markdown converter written in JavaScript
https://mixmark-io.github.io/turndown
MIT License
8.82k stars 880 forks source link

Do not support table convert #416

Open thanksqq opened 2 years ago

thanksqq commented 2 years ago
The tool cannot convert table, remove all table marks. We should convert table to this format: aaa bbb ccc
1 2 3
4 5 6
7 8 9
phy25 commented 1 year ago

GitHub Flavoured Markdown extension supports it: https://github.com/domchristie/turndown-plugin-gfm.

CALLMELARE commented 1 year ago

You can solve this problem by plugin turndown-plugin-gfm. The usage method is as follows:

import TurndownService from 'turndown';
import { gfm } from 'turndown-plugin-gfm';

const td = new TurndownService();
td.use(gfm);
RobertoPegoraro commented 1 year ago

turndown-plugin-gfm is outdated, the last version is from 2017 and it doesn't work now a days. I need another solution

adamalfredsson commented 1 year ago

turndown-plugin-gfm is outdated, the last version is from 2017 and it doesn't work now a days. I need another solution

Did you find any other solution?

RobertoPegoraro commented 1 year ago

turndown-plugin-gfm is outdated, the last version is from 2017 and it doesn't work now a days. I need another solution

Did you find any other solution?

Yeap using: joplin-turndown-plugin-gfm

// For Node.js 
var TurndownService = require('turndown')
var turndownPluginGfm = require('joplin-turndown-plugin-gfm')

var gfm = turndownPluginGfm.gfm
var turndownService = new TurndownService()
turndownService.use(gfm)
var markdown = turndownService.turndown(html)
console.log(markdown)
shaipetel commented 9 months ago

Yes! that new gfm plugin is working. Need to update docs - but thanks!