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")]
|
2018-01-13 18:36:56 +00:00
|
|
|
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")]
|
2018-01-13 18:36:56 +00:00
|
|
|
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(
|
2018-01-13 18:36:56 +00:00
|
|
|
Dialog::around(TextView::new(text)).button("Hell yeah!", |s| s.quit()),
|
2018-01-10 22:58:29 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
siv.run();
|
|
|
|
}
|