remove-markdown
Advanced tools
Comparing version 0.5.2 to 0.5.3
13
index.js
@@ -10,2 +10,3 @@ module.exports = function(md, options) { | ||
options.htmlTagsToSkip = options.hasOwnProperty('htmlTagsToSkip') ? options.htmlTagsToSkip : []; | ||
options.throwError = options.hasOwnProperty('throwError') ? options.throwError : false; | ||
@@ -52,3 +53,3 @@ var output = md || ''; | ||
joinedHtmlTagsToSkip + | ||
'[^>]*>', | ||
'[^>]*>', | ||
'ig' | ||
@@ -79,6 +80,4 @@ ); | ||
.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 | ||
@@ -95,3 +94,5 @@ .replace(/(`{3,})(.*?)\1/gm, '$2') | ||
} catch(e) { | ||
console.error(e); | ||
if (options.throwError) throw e; | ||
console.error("remove-markdown encountered error: %s", e); | ||
return md; | ||
@@ -98,0 +99,0 @@ } |
{ | ||
"name": "remove-markdown", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "Remove Markdown formatting from text", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
17411
7
268
0