Skip to content

Commit

Permalink
Merge pull request #83 from zuchka/revert-73-fixed-sequance-of-escape…
Browse files Browse the repository at this point in the history
…d-markdown-issue

Revert "- refactor regex of escaped markdown to fix multiple italic markdown issue"
  • Loading branch information
zuchka authored Sep 1, 2024
2 parents d87ebed + 6d77334 commit 6d296bc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function(md, options) {
htmlReplaceRegex = new RegExp(
'<' +
joinedHtmlTagsToSkip +
'[^>]*>',
'[^>]*>',
'ig'
);
}
Expand All @@ -75,8 +75,10 @@ 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
.replace(/(_+)(.*?\S)(_+)/g, '$1$3$4$5')
// 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 code blocks
.replace(/(`{3,})(.*?)\1/gm, '$2')
// Remove inline code
Expand Down

0 comments on commit 6d296bc

Please sign in to comment.