Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mehdown

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mehdown - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

13

lib/index.js

@@ -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() {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc