0.2.7 • Published 10 years ago

baybay v0.2.7

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

baybay(ˈbeɪbeɪ)

NPM version Build Status
...is a BBCode parser in JS, returning HTML output.

Why..?

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.

Usage

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:

<b>[<i>dumb []t<b>e</b>xt[x] <span style="color: red;">and an</span>
<img src="http://localhost/image.png"></i></b>

Installation

Through Node Package Manager: npm install baybay
Or directly through Git: git clone https://github.com/noorus/baybay.git

Building

When using baybay in the browser, you might want to build the minified version baybay.min.js.
To do this, call grunt uglify.

License

Baybay is licensed under the MIT license.
For full license text, see the LICENSE file.

0.2.7

10 years ago

0.2.3

10 years ago

0.2.1

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago