npm install baybay

...is a BBCode parser in JS, returning HTML output.
Well, honestly, because all the other parsers I looked at were kinda bad.
You don't need 1500 lines for a BBCode parser. You just don't.
So here we are. One loop, a stack and a couple string utils.
Baybay is a small UMD module and does not depend on anything.
Baybay does its best to be idiot-proof, and will never generate invalid HTML.
var bb = require( "baybay" );
var str = "[b][[i]dumb []t[b]e[/b]xt[x] [color=red]and an[/color] \
[img]http://localhost/image.png";
console.log( bb.parse( str ) );
This example gives you:
[dumb []text[x] and an

Through Node Package Manager: npm install baybay
Or directly through Git: git clone https://github.com/noorus/baybay.git
When using baybay in the browser, you might want to build the minified version baybay.min.js.
To do this, call grunt uglify.
Baybay is licensed under the MIT license.
For full license text, see the LICENSE file.