From e27907e5b48265c2a2ed8129fa41e9d96bbd5c82 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Mon, 8 Oct 2018 20:40:59 +0800 Subject: [PATCH] Turndown: cover table from Microsoft Excel --- src/utils/turndown/turndown-plugin-gfm.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/turndown/turndown-plugin-gfm.js b/src/utils/turndown/turndown-plugin-gfm.js index f76556a6..4d66997a 100644 --- a/src/utils/turndown/turndown-plugin-gfm.js +++ b/src/utils/turndown/turndown-plugin-gfm.js @@ -90,7 +90,7 @@ rules.tableRow = { }; rules.table = { - // Only convert tables with a heading row. + // If configs.autoHead is false, only convert tables with a heading row. // Tables with no heading row are kept using `keep` (see below). filter: function (node) { return node.nodeName === 'TABLE' @@ -142,7 +142,9 @@ function isFirstTbody (element) { ( previousSibling.nodeName === 'THEAD' && /^\s*$/i.test(previousSibling.textContent) - ) + ) || + // For parsting table from Microsoft Excel. + previousSibling.nodeName == 'COLGROUP' ) ) }