diff --git a/index.js b/index.js index f025845..033093f 100644 --- a/index.js +++ b/index.js @@ -48,7 +48,7 @@ module.exports = function(md, options) { htmlReplaceRegex = new RegExp( '<' + joinedHtmlTagsToSkip + - '[^>]*>', + '[^>]*>', 'ig' ); } @@ -74,10 +74,8 @@ module.exports = function(md, options) { .replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, '$1$3$4$6') // Remove * emphasis .replace(/([\*]+)(\S)(.*?\S)??\1/g, '$2$3') - // Remove _ emphasis. Unlike *, _ emphasis gets rendered only if - // 1. Either there is a whitespace character before opening _ and after closing _. - // 2. Or _ is at the start/end of the string. - .replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, '$1$3$4$5') + // Remove _ emphasis + .replace(/(_+)(.*?\S)(_+)/g, '$1$3$4$5') // Remove code blocks .replace(/(`{3,})(.*?)\1/gm, '$2') // Remove inline code