use termimad::{
minimad,
};
static MD: &str = r#"
This text has too many indentations,
hard-wrapping breaking an *italic
part*, some code, and some **bold
sub-sentence** too.
To have span continue across lines,
parse markdown with `minimad::parse_text(
src, TreeOptions::default().continue_spans());`
To fix superfluous indentations, use
let options = TreeOptions::default()
.clean_indentations();
"#;
fn print_md(s: &str) {
print_text(minimad::parse_text(s, minimad::Options::default()));
}
fn print_text(text: minimad::Text) {
let skin = termimad::get_default_skin();
let fmt_text = termimad::FmtText::from_text(skin, text, None);
println!("{fmt_text}");
}
fn main() {
println!();
print_md("# Raw Text:");
println!("{MD}");
println!();
print_md("# Parsed, with indentations cleaned:");
let options = minimad::Options::default()
.clean_indentations(true);
let text = minimad::parse_text(MD, options);
print_text(text);
println!();
print_md("# With span continuation too:");
let options = minimad::Options::default()
.clean_indentations(true)
.continue_spans(true);
let text = minimad::parse_text(MD, options);
print_text(text);
}