BB Code 2.0 (aka KBB) - the redefined BB-Code
npm install bb2



This is JavaScript implementation of BBCode 2.0.
BBCode 2.0 is a new modern redefinition of BBCode. It introduces smart closing of tags, relaxes tags structure, introduces number of extensions and simplifies adding custom extensions.
It is alternative to other markup languages:
* it's more structural, extendable and verbose than markdown
* less structural and verbose than HTML
Therefore, the main use is for professional users: it's markup language and rich-text content description for server and browser, which can be rendered to HTML and SVG, as tags/text or directly into DOM.
This is complicated - because you have to remember to close everything.
Why not just
This is [b][i][u]less complicated[/][/][/] - because you just auto-close last tag.
This is bold and italicor just italic text.
Why not just
This is [b]bold and [i]italic[/b]or just italic[/i] text.
Why not just
[li]BBCode way
[li]of handling
[li]lists
[/]
npm install bb2
npm test
// example_basic.js
const BBCodeHtml = require('bb2').BBCodeHtml
const bb = new BBCodeHtml()
console.log(bb.parse('visible [0]invisible[1] [b]bold[/] [i]italic[/] [u]underline[/]'))
`
Examples
Look into /examples folder.
To run examples, run this ONCE:
`
cd examples
node 0_prepare.js
`
This:
- prepares the folder structure as to pretend that's a real project.
- creates the gallery.html file, which contains all the results from - just open that in the browserAfter prepare, you can hit any of example_*.js like that:
`
node example_basic.js
``For details go to http://doc.ke.mu/doc/bb
This project is sponsored by Kemu Studio and used as main rich-text engine in Calculla.