remove-markdown
Advanced tools
Comparing version 0.0.5 to 0.0.6
34
index.js
@@ -10,15 +10,23 @@ module.exports = function(md, options) { | ||
} | ||
output = output.replace(/<(.*?)>/g, '$1') | ||
.replace(/^[=\-]{2,}\s*$/g, '') | ||
.replace(/\[\^.+?\](\: .*?$)?/g, '') | ||
.replace(/\s{0,2}\[.*?\]: .*?$/g, '') | ||
.replace(/\!\[.*?\][\[\(].*?[\]\)]/g, '') | ||
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1') | ||
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '') | ||
.replace(/^\#{1,6}\s*([^#]*)\s*(\#{1,6})?/g, '$1') | ||
.replace(/([\*_]{1,2})(\S.*?\S)\1/g, '$2') | ||
.replace(/(`{3,})(.*?)\1/gm, '$2') | ||
.replace(/^-{3,}\s*$/g, '') | ||
.replace(/`(.+?)`/g, '$1') | ||
.replace(/\n{2,}/g, '\n\n'); | ||
output = output | ||
// Remove HTML tags | ||
.replace(/<(.*?)>/g, '$1') | ||
// Remove setext-style headers | ||
.replace(/^[=\-]{2,}\s*$/g, '') | ||
// Remove footnotes? | ||
.replace(/\[\^.+?\](\: .*?$)?/g, '') | ||
.replace(/\s{0,2}\[.*?\]: .*?$/g, '') | ||
// Remove images | ||
.replace(/\!\[.*?\][\[\(].*?[\]\)]/g, '') | ||
// Remove inline links | ||
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1') | ||
// Remove reference-style links? | ||
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '') | ||
// Remove atx-style headers | ||
.replace(/^\#{1,6}\s*([^#]*)\s*(\#{1,6})?/gm, '$1') | ||
.replace(/([\*_]{1,2})(\S.*?\S)\1/g, '$2') | ||
.replace(/(`{3,})(.*?)\1/gm, '$2') | ||
.replace(/^-{3,}\s*$/g, '') | ||
.replace(/`(.+?)`/g, '$1') | ||
.replace(/\n{2,}/g, '\n\n'); | ||
} catch(e) { | ||
@@ -25,0 +33,0 @@ console.error(e); |
{ | ||
"name": "remove-markdown", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Remove Markdown formatting from text", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,4 @@ ## This is a heading ## | ||
### This is another heading | ||
In `Getting Started` we set up `something` foo. | ||
@@ -7,0 +9,0 @@ |
@@ -5,2 +5,4 @@ This is a heading | ||
This is another heading | ||
In Getting Started we set up something foo. | ||
@@ -7,0 +9,0 @@ |
4968
46