remove-markdown 0.2.1 → 0.2.2
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.
- package/index.js +2 -2
- package/package.json +1 -1
- package/test/remove-markdown.js +38 -1
package/index.js
CHANGED
|
@@ -37,8 +37,8 @@ module.exports = function(md, options) {
|
|
|
37
37
|
.replace(/\!\[.*?\][\[\(].*?[\]\)]/g, '')
|
|
38
38
|
// Remove inline links
|
|
39
39
|
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
|
|
40
|
-
// Remove
|
|
41
|
-
.replace(
|
|
40
|
+
// Remove blockquotes
|
|
41
|
+
.replace(/^\s{0,3}>\s?/g, '')
|
|
42
42
|
// Remove reference-style links?
|
|
43
43
|
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
|
|
44
44
|
// Remove atx-style headers
|
package/package.json
CHANGED
package/test/remove-markdown.js
CHANGED
|
@@ -67,7 +67,7 @@ describe('remove Markdown', function () {
|
|
|
67
67
|
const string = '**this sentence has __double styling__**';
|
|
68
68
|
const expected = 'this sentence has double styling';
|
|
69
69
|
expect(removeMd(string)).to.equal(expected);
|
|
70
|
-
});
|
|
70
|
+
});
|
|
71
71
|
|
|
72
72
|
it('should remove horizontal rules', function () {
|
|
73
73
|
const string = 'Some text on a line\n\n---\n\nA line below';
|
|
@@ -81,6 +81,43 @@ describe('remove Markdown', function () {
|
|
|
81
81
|
expect(removeMd(string)).to.equal(expected);
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
+
it('should remove blockquotes', function () {
|
|
85
|
+
const string = '>I am a blockquote';
|
|
86
|
+
const expected = 'I am a blockquote';
|
|
87
|
+
expect(removeMd(string)).to.equal(expected);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should remove blockquotes with spaces', function () {
|
|
91
|
+
const string = '> I am a blockquote';
|
|
92
|
+
const expected = 'I am a blockquote';
|
|
93
|
+
expect(removeMd(string)).to.equal(expected);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should remove indented blockquotes', function () {
|
|
97
|
+
var tests = [
|
|
98
|
+
{ string: ' > I am a blockquote', expected: 'I am a blockquote' },
|
|
99
|
+
{ string: ' > I am a blockquote', expected: 'I am a blockquote' },
|
|
100
|
+
{ string: ' > I am a blockquote', expected: 'I am a blockquote' },
|
|
101
|
+
];
|
|
102
|
+
tests.forEach(function (test) {
|
|
103
|
+
expect(removeMd(test.string)).to.equal(test.expected);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should not remove greater than signs', function () {
|
|
108
|
+
var tests = [
|
|
109
|
+
{ string: '100 > 0', expected: '100 > 0' },
|
|
110
|
+
{ string: '100 >= 0', expected: '100 >= 0' },
|
|
111
|
+
{ string: '100>0', expected: '100>0' },
|
|
112
|
+
{ string: '> 100 > 0', expected: '100 > 0' },
|
|
113
|
+
{ string: '1 < 100', expected: '1 < 100' },
|
|
114
|
+
{ string: '1 <= 100', expected: '1 <= 100' },
|
|
115
|
+
];
|
|
116
|
+
tests.forEach(function (test) {
|
|
117
|
+
expect(removeMd(test.string)).to.equal(test.expected);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
84
121
|
it('should strip unordered list leaders', function () {
|
|
85
122
|
const string = 'Some text on a line\n\n* A list Item\n* Another list item';
|
|
86
123
|
const expected = 'Some text on a line\n\nA list Item\nAnother list item';
|