npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bitter-bbcode

v0.0.1

Published

A module for parsing BBCode and translating it to HTML.

Downloads

85

Readme

bitter-bbcode

A simple BBCode parser. It's "bitter" because it's written in CoffeeScript, you see.

The concept is to support some form of "generic" BBCode out of the box that covers the majority of software platforms out there, while being extensible enough that new BBCodes can be added without breaking anything.

Because it parses to a "DOM" it should be possible to export to destinations that aren't BBCode, for example, it should be possible to write a BBCode to Markdown translator.

It supports very simplistic BBCode at present:

[b]Bold[/b]
[i]Italic[/i]
[u]Underline[/u]
[url=https://www.github.com/]GitHub[/url]

Becomes:

<p><b>Bold</b><br>
<i>Italic</i><br>
<u>Underline</u><br>
<a href="https://www.github.com/">GitHub</a></p>

Basic Usage

var bbcode = require('bitter-bbcode');

bbcode("Some [b]text[/b]");
// Result: "<p>Some <b>text</b></p>");

More advanced use

var bbcode = require('bitter-bbcode');
var parser = bbcode();
var bbdom = parser.parse("[b]Some BB Code[/b]");
blocks = bbdom.toBlocks();
blocks.toHTML();

BBCode Compatibility

This is currently targeted at supporting phpBB-style BBCode. The ultimate goal is to make it configurable enough that various BBCode styles can be supported, including a default "global" mode that accepts the majority of BBCode used by the majority of forums that support BBCode.

Supported BBCode Table

The following describes the BBCode available in popular BBCode implementations compared to this implementation. If the tag is in the table and unless otherwise noted, it is planned to be implemented in the future.

BBCode | Description | Supported? ------------------|----------------------------------------------------|------------------- [b] | Bold text | :white_check_mark: [i] | Italic text | :white_check_mark: [u] | Underline text | :white_check_mark: [s] | Strike-though text | :white_check_mark: [sub] | Subscript text | :white_check_mark: [super] | Superscript text | :white_check_mark: [fixed] | Fixed-width text | :x: [color=color] | Text in the specified color | :x: [size=size] | Change text size | :x: [url] | Link | :white_check_mark: [url=url] | Link | :white_check_mark: [email] | Link an email address | :x: [email=email] | Link an email address | :x: [img] | Image | :white_check_mark: [timg] | Thumbnailed image | :x:¹ [flash] | Embedding flash content | :x:² [video] | Embedding video content | :x:¹ [list] | Unordered List | :white_check_mark: [list=1] | Numerically Ordered List | :white_check_mark: [list=a] | Alphabetically Ordered List | :white_check_mark: [quote] | Quote | :white_check_mark: [quote="name"] | Quote with a given name | :white_check_mark: [code] | BBCode ignored code block | :white_check_mark: [code=language] | BBCode ignored code block with syntax highlighting | :warning:³ [php] | Same as [code=php] | :x:

¹ It is unlikely this tag will ever be enabled by default ² It is unlikely that embedding Flash will ever be supported by this library ³ Syntax highlighting is not supported at present

BBCode by bulletin board software

Check out the [full comparison tables](compat/Comparison Tables.md) for details about how this library differs from other BBCode implementations.