use ansi_term::{ANSIStrings, Color, Style};
use tui_markup::generator::ANSIStringsGenerator;
use tui_markup::{compile, compile_with};

fn main() {
    // Parse markup into some final result for showing
    let result = compile::<ANSIStringsGenerator>("You got a <yellow Coin>").unwrap();
    // Show it
    println!("{}", ANSIStrings(&result));

    // With custom tag
    let generator = ANSIStringsGenerator::new(|tag: &str| match tag {
        "keyboard" => Some(Style::default().fg(Color::Blue).on(Color::Black).bold()),
        "bold" => Some(Style::default().bold()),
        "under" => Some(Style::default().underline()),
        _ => None,
    });
    let result = compile_with("Press <keyboard Space> to <bold <under jump>>", generator).unwrap();
    println!("{}", ANSIStrings(&result));
}
