mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-07-11 10:46:15 +09:00
Convert tables to markdown
This commit is contained in:
Generated
+5
@@ -1572,6 +1572,11 @@
|
||||
"jsdom": "^16.2.0"
|
||||
}
|
||||
},
|
||||
"turndown-plugin-gfm": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/turndown-plugin-gfm/-/turndown-plugin-gfm-1.0.2.tgz",
|
||||
"integrity": "sha512-vwz9tfvF7XN/jE0dGoBei3FXWuvll78ohzCZQuOb+ZjWrs3a0XhQVomJEb2Qh4VHTPNRO4GPZh0V7VRbiWwkRg=="
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"request": "^2.88.2",
|
||||
"request-promise-native": "^1.0.8",
|
||||
"turndown": "^6.0.0",
|
||||
"turndown-plugin-gfm": "^1.0.2",
|
||||
"xml2js": "^0.4.23"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const turndown = require('turndown');
|
||||
const turndownPluginGfm = require('turndown-plugin-gfm');
|
||||
|
||||
function initTurndownService() {
|
||||
const turndownService = new turndown({
|
||||
@@ -7,6 +8,8 @@ function initTurndownService() {
|
||||
codeBlockStyle: 'fenced'
|
||||
});
|
||||
|
||||
turndownService.use(turndownPluginGfm.tables);
|
||||
|
||||
// preserve embedded tweets
|
||||
turndownService.addRule('tweet', {
|
||||
filter: node => node.nodeName === 'BLOCKQUOTE' && node.getAttribute('class') === 'twitter-tweet',
|
||||
|
||||
Reference in New Issue
Block a user