remove-markdown 0.6.1 → 0.6.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 CHANGED
@@ -58,7 +58,7 @@ module.exports = function(md, options) {
58
58
  // Remove images
59
59
  .replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? '$1' : '')
60
60
  // Remove inline links
61
- .replace(/\[([^\]]*?)\][\[\(].*?[\]\)]/g, options.replaceLinksWithURL ? '$2' : '$1')
61
+ .replace(/\[([\s\S]*?)\]\s*[\(\[].*?[\)\]]/g, options.replaceLinksWithURL ? '$2' : '$1')
62
62
  // Remove blockquotes
63
63
  .replace(/^(\n)?\s{0,3}>\s?/gm, '$1')
64
64
  // .replace(/(^|\n)\s{0,3}>\s?/g, '\n\n')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remove-markdown",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Remove Markdown formatting from text",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -197,6 +197,18 @@ describe('remove Markdown', function () {
197
197
  expect(removeMd(paragraph)).to.equal(expected);
198
198
  });
199
199
 
200
+ it('should remove links', function () {
201
+ const string = 'This is a [link](http://www.disney.com/).';
202
+ const expected = 'This is a link.';
203
+ expect(removeMd(string)).to.equal(expected);
204
+ });
205
+
206
+ it('should remove links with square brackets', function () {
207
+ const string = 'This is a [link [with brackets]](http://www.disney.com/).';
208
+ const expected = 'This is a link [with brackets].';
209
+ expect(removeMd(string)).to.equal(expected);
210
+ });
211
+
200
212
  it('should not strip paragraphs without content', function() {
201
213
  const paragraph = '\n#This paragraph\n##This paragraph#';
202
214
  const expected = paragraph;