#pull-parser #robust #token-parser #bb-code #html #bbcode

no-std bbx

A robust, performant BBCode pull parser

4 releases (2 breaking)

0.3.1 May 1, 2024
0.3.0 May 1, 2024
0.2.0 May 1, 2024
0.1.0 May 1, 2024

#641 in Encoding

MIT license

53KB
1K SLoC

BBX

Crates.io MSRV Crates.io License Crates.io Version docs.rs Discord

A robust and performant (constant time, no recursion) BBCode pull parser with no_std/alloc support.

Examples

Quick parsing

// Parse a document, throwing all of its component tokens into the console.
let mut parser = BBParser::new(input);

for token in parser {
    println!("{:?}", token);
}

Quick sanitized HTML output

// Simple serializer default with all of the v1.0.0 (or earlier) tags considered "core" to the library.
let mut serializer: HtmlSerializer<SimpleHtmlWriter> = 
    HtmlSerializer::with_tags(all_core_v1_tags());
let mut parser = BBParser::new(input);
println!("Document:");
println!("{}", serializer.serialize(parser));

Dependencies

~185KB