remove-markdown 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -49,7 +49,7 @@ module.exports = function(md, options) {
49
49
  htmlReplaceRegex = new RegExp(
50
50
  '<' +
51
51
  joinedHtmlTagsToSkip +
52
- '[^>]*>',
52
+ '[^>]*>',
53
53
  'ig'
54
54
  );
55
55
  }
@@ -75,8 +75,10 @@ module.exports = function(md, options) {
75
75
  .replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, '$1$3$4$6')
76
76
  // Remove * emphasis
77
77
  .replace(/([\*]+)(\S)(.*?\S)??\1/g, '$2$3')
78
- // Remove _ emphasis
79
- .replace(/(_+)(.*?\S)(_+)/g, '$1$3$4$5')
78
+ // Remove _ emphasis. Unlike *, _ emphasis gets rendered only if
79
+ // 1. Either there is a whitespace character before opening _ and after closing _.
80
+ // 2. Or _ is at the start/end of the string.
81
+ .replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, '$1$3$4$5')
80
82
  // Remove code blocks
81
83
  .replace(/(`{3,})(.*?)\1/gm, '$2')
82
84
  // Remove inline code
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remove-markdown",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Remove Markdown formatting from text",
5
5
  "main": "index.js",
6
6
  "scripts": {