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

bbcode

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bbcode - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

16

lib/bbcode.js

@@ -161,3 +161,3 @@ // -----------------------------------------------------------------------

urlstart = -1;
return "<a href=\"" + m3 + "\">";
return "<a target=\"_blank\" href=\"" + m3 + "\">";
}

@@ -169,3 +169,3 @@

// and treat the text following [url] as a URL
return "<a href=\"";
return "<a target=\"_blank\" href=\"";
case "img":

@@ -193,5 +193,13 @@ opentags.push(new taginfo_t(m2, "\" />"));

return '<ul>';
case "b":
opentags.push(new taginfo_t('b', '</strong>'));
return '<strong>';
case "i":
opentags.push(new taginfo_t('i', '</em>'));
return '<em>';
default:
// [samp], [b], [i] and [u] don't need special processing
// [samp] and [u] don't need special processing
opentags.push(new taginfo_t(m2, "</" + m2 + ">"));

@@ -286,2 +294,2 @@ return "<" + m2 + ">";

}
}
}

@@ -5,3 +5,3 @@ {

"main": "./lib/bbcode",
"version": "0.1.2",
"version": "0.1.3",
"author": "Nick Campbell (http://github.com/ncb000gt)",

@@ -26,3 +26,6 @@ "repository": {

"should": "1.1.0"
},
"scripts": {
"test": "mocha --require should ./tests/parse"
}
}

@@ -7,11 +7,11 @@ var bbcode = require('../lib/bbcode');

describe('#parse', function() {
it('should parse [b] to <b>', function() {
it('should parse [b] to <strong>', function() {
bbcode.parse('[b]Bold[/b]', function(parse) {
parse.should.equal('<b>Bold</b>');
parse.should.equal('<strong>Bold</strong>');
});
});
it('should parse [i] to <i>', function() {
it('should parse [i] to <em>', function() {
bbcode.parse('[i]italics[/i]', function(parse) {
parse.should.equal('<i>italics</i>');
parse.should.equal('<em>italics</em>');
});

@@ -25,3 +25,3 @@ });

});
it('should parse [samp] to <samp>', function() {

@@ -55,3 +55,3 @@ bbcode.parse('[samp]samp[/samp]', function(parse) {

});
it('should parse [s] to <span style="text-decoration: line-through"', function() {

@@ -66,3 +66,3 @@ bbcode.parse('[s]strikethrough[/s]', function(parse) {

bbcode.parse('[url=http://example.com]url[/url]', function(parse) {
parse.should.equal('<a href="http://example.com">url</a>');
parse.should.equal('<a target="_blank" href="http://example.com">url</a>');
});

@@ -73,3 +73,3 @@ });

bbcode.parse('[url="http://example.com"]url[/url]', function(parse) {
parse.should.equal('<a href="http://example.com">url</a>');
parse.should.equal('<a target="_blank" href="http://example.com">url</a>');
});

@@ -80,3 +80,3 @@ });

bbcode.parse('[url=\'http://example.com\']url[/url]', function(parse) {
parse.should.equal('<a href="http://example.com">url</a>');
parse.should.equal('<a target="_blank" href="http://example.com">url</a>');
});

@@ -87,3 +87,3 @@ });

bbcode.parse('[link=http://example.com]url[/link]', function(parse) {
parse.should.equal('<a href="http://example.com">url</a>');
parse.should.equal('<a target="_blank" href="http://example.com">url</a>');
});

@@ -94,3 +94,3 @@ });

bbcode.parse('[link="http://example.com"]url[/link]', function(parse) {
parse.should.equal('<a href="http://example.com">url</a>');
parse.should.equal('<a target="_blank" href="http://example.com">url</a>');
});

@@ -101,3 +101,3 @@ });

bbcode.parse('[link=\'http://example.com\']url[/link]', function(parse) {
parse.should.equal('<a href="http://example.com">url</a>');
parse.should.equal('<a target="_blank" href="http://example.com">url</a>');
});

@@ -147,3 +147,3 @@ });

bbcode.parse('[b]test', function(parse) {
parse.should.equal('<b>test</b>');
parse.should.equal('<strong>test</strong>');
});

@@ -192,5 +192,5 @@ });

it('should parse inner tags [b][i][u] to <b><i><u>', function() {
it('should parse inner tags [b][i][u] to <strong><em><u>', function() {
bbcode.parse('[b][i][u]Hai[/u][/i][/b]', function(parse) {
parse.should.equal('<b><i><u>Hai</u></i></b>');
parse.should.equal('<strong><em><u>Hai</u></em></strong>');
});

@@ -201,5 +201,5 @@ });

var parse = bbcode.parse('[b][i][u]Hai[/u][/i][/b]');
parse.should.equal('<b><i><u>Hai</u></i></b>');
parse.should.equal('<strong><em><u>Hai</u></em></strong>');
});
});
});
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