Crate bbx

source ·
Expand description

Robust and performant BBCode pull parser.

§Examples

§Simple parsing

let mut parser = BBParser::new(/* &str */ input);

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

§Built-in sanitized HTML output

// Simple serializer default with all of the v1.0.0 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));

§no_std

This feature set is std (hosted) only, due to the following features:

  • track_open_tags
  • parser_rules
  • html_gen (required std!)

Modules§

  • Simple HTML serialization from a BBParser’s output. While not comprehensive of more exotic usecases, likely sufficient for most and includes many pre-made tags.
  • Parser rules, which can be pushed into a BBParser mid-iteration to change how parsing behaves.

Structs§

  • Provides a BBCode parser over the given input, in the form of an iterator. BBParser is a pull parser, parsing the input on an on-demand basis as the user calls BBParser::next.
  • Simple struct representing the tag and (possibly empty) arguments of a bbcode tag.
  • Provides configuration information for BBParser, including enabled feature flags.
  • Represents a set of flags.
  • A parsed token, as returned by BBParser::next.

Enums§

  • Represents the type of a token in the parsed data.