From 41ebf3a7ef752ba91d0be3503e412fe309a57c28 Mon Sep 17 00:00:00 2001 From: Dylan Bussone Date: Tue, 17 Feb 2015 14:04:09 -0800 Subject: [PATCH] Fix for neighboring like tags leaking markdown text --- html2markdown.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/html2markdown.js b/html2markdown.js index 518d75e..655a1fc 100644 --- a/html2markdown.js +++ b/html2markdown.js @@ -228,7 +228,11 @@ function html2markdown(html, opts) { case "dfn": case "var": case "cite": - nodeList.push(markdownTags[tag]); + if (nodeList[nodeList.length-1] === markdownTags[tag]) { + nodeList.splice(nodeList.length-1, 1); + } else { + nodeList.push(markdownTags[tag]); + } break; case "code": case "span":