Comparing version 1.7.0 to 1.8.0
@@ -73,5 +73,2 @@ var Mehdown; | ||
// Spoilers | ||
text = text.replace(/\[spoiler\](.*?)\[\/spoiler\]/gi, Mehdown.spoiler('$1')); | ||
// Usernames | ||
@@ -106,3 +103,3 @@ text = text.replace(Mehdown.usernameRegExp, '$1' + Mehdown.username('$2')); | ||
var headerRegExp = new RegExp('<h\\d[^>]*>([^<]+)</h\\d>', 'gi'); | ||
var headerRegExp = new RegExp('<h\\d[^>]*>(.+)</h\\d>', 'gi'); | ||
text = text.replace(headerRegExp, Mehdown.header(opts.suffix)); | ||
@@ -157,4 +154,4 @@ | ||
return function(header) { | ||
var text = header.replace(/<h\d[^>]*>([^<]+)<\/h\d>/, '$1'); | ||
text = toSlug(text); | ||
var text = header.replace(/<h\d[^>]*>(.+)<\/h\d>/, '$1'); | ||
text = toSlug(text.replace(/<.*?>/g, '')); | ||
@@ -174,6 +171,2 @@ if (suffix) { | ||
Mehdown.spoiler = function(spoiler) { | ||
return '<span class="spoiler">' + spoiler + '</span>'; | ||
}; | ||
Mehdown.soundcloud = function(match, url) { | ||
@@ -180,0 +173,0 @@ return '<iframe class="soundcloud" frameborder="0" src="https://w.soundcloud.com/player/?url=' + encodeURIComponent(url) + '"></iframe>'; |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "1.7.0" | ||
"version": "1.8.0" | ||
} |
@@ -11,3 +11,2 @@ mehdown | ||
- Detection of @usernames | ||
- Support for spoilers in the BBCode syntax of: [spoiler]This text will be blurred until you mouse over it[/spoiler] | ||
- Support for strikethrough using \~~strikethrough~~ syntax | ||
@@ -14,0 +13,0 @@ - Support for converting image URLs to `<img>` tags |
@@ -82,3 +82,3 @@ var assert = require('assert'); | ||
it('hanlde suffix with non alpha-numeric characters', function() { | ||
it('handle suffix with non alpha-numeric characters', function() { | ||
var text = mehdown.parse('<h1>a- -b?c</h1>', { suffix: '!@#$%^&*()=+`~,./;\'<>?:"[]{}|' }); | ||
@@ -92,2 +92,7 @@ assert.equal(text, '<h1 id="a-bc-">a- -b?c</h1>'); | ||
}); | ||
it('handle header with other tags inside', function() { | ||
var text = mehdown.parse('<h1><strong>bold</strong></h1>'); | ||
assert.equal(text, '<h1 id="bold"><strong>bold</strong></h1>'); | ||
}); | ||
}); | ||
@@ -183,14 +188,2 @@ | ||
describe('spoilers', function() { | ||
it('[spoiler]Hello[/spoiler]', function() { | ||
var text = mehdown.parse('<p>[spoiler]Hello[/spoiler]</p>'); | ||
assert.equal(text, '<p><span class="spoiler">Hello</span></p>'); | ||
}); | ||
it('[spoiler]Hello[/spoiler] [spoiler]World[/spoiler]', function() { | ||
var text = mehdown.parse('<p>[spoiler]Hello[/spoiler] [spoiler]World[/spoiler]</p>'); | ||
assert.equal(text, '<p><span class="spoiler">Hello</span> <span class="spoiler">World</span></p>'); | ||
}); | ||
}); | ||
describe('SoundCloud URLs', function() { | ||
@@ -197,0 +190,0 @@ it('https://soundcloud.com/shawnmichaelmiller/santa-claus-is-coming-to-town', function() { |
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
36104
365
20