mc-legacy-formatting
A parser for Minecraft's legacy formatting system, created with careful attention to the quirks of the vanilla client's implementation.
Features
- Iterator-based, non-allocating parser
- Supports
#![no_std]usage (withdefault-featuresset tofalse) - Implements the entire spec as well as vanilla client quirks (such as handling
of whitespace with the
STRIKETHROUGHstyle) - Helpers for pretty-printing the parsed
Spans to the terminal - Support for parsing any start character for the formatting codes (vanilla
uses
§while many community tools use&)
Examples
Using SpanIter:
use ;
let s = "§4This will be dark red §oand italic";
let mut span_iter = s.span_iter;
assert_eq!;
assert_eq!;
assert!;
With a custom start character:
use ;
let s = "&6It's a lot easier to type &b& &6than &b§";
let mut span_iter = s.span_iter.with_start_char;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert!;