diff --git a/src/translator.js b/src/translator.js index a317f4b..2642106 100644 --- a/src/translator.js +++ b/src/translator.js @@ -34,6 +34,14 @@ function initTurndownService() { replacement: (content, node) => '\n\n' + node.outerHTML }); + //
within can cause extra whitespace that wreck markdown links, so this removes them + turndownService.addRule('a', { + filter: 'a', + replacement: (content) => { + return content.replace(/<\/?div[^>]*>/gi, ''); + } + }); + // preserve embedded scripts (for tweets, codepens, gists, etc.) turndownService.addRule('script', { filter: 'script',