cursive/examples/markup.rs
Alexandre Bury 39405ba1ec Refactor spans and markup
We now use mostly indexed spans into a source string.
Indexed Spans can still be resolved to a string slice when needed.
2018-01-15 13:53:27 -08:00

27 lines
617 B
Rust

extern crate cursive;
use cursive::Cursive;
#[cfg(feature = "markdown")]
use cursive::utils::markup::markdown;
use cursive::views::{Dialog, TextView};
// Make sure you compile with the `markdown` feature!
//
// cargo run --example markup --features markdown
fn main() {
let mut siv = Cursive::new();
#[cfg(feature = "markdown")]
let text = markdown::parse("Isn't *that* **cool**?");
#[cfg(not(feature = "markdown"))]
let text = "Rebuild with --features markdown ;)";
siv.add_layer(
Dialog::around(TextView::new(text)).button("Hell yeah!", |s| s.quit()),
);
siv.run();
}