cursive/examples/markup.rs

27 lines
617 B
Rust
Raw Normal View History

2018-01-10 22:58:29 +00:00
extern crate cursive;
use cursive::Cursive;
2018-01-10 23:03:42 +00:00
#[cfg(feature = "markdown")]
use cursive::utils::markup::markdown;
2018-01-10 22:58:29 +00:00
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();
2018-01-10 23:03:42 +00:00
#[cfg(feature = "markdown")]
let text = markdown::parse("Isn't *that* **cool**?");
2018-01-10 22:58:29 +00:00
2018-01-10 23:03:42 +00:00
#[cfg(not(feature = "markdown"))]
let text = "Rebuild with --features markdown ;)";
2018-01-10 22:58:29 +00:00
siv.add_layer(
Dialog::around(TextView::new(text)).button("Hell yeah!", |s| s.quit()),
2018-01-10 22:58:29 +00:00
);
siv.run();
}