cursive/examples/markup.rs

28 lines
643 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")]
2018-01-10 22:58:29 +00:00
use cursive::utils::markup::MarkdownText;
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-10 22:58:29 +00:00
let text = MarkdownText("Isn't *that* **cool**?");
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::styled(text).unwrap())
.button("Hell yeah!", |s| s.quit()),
);
siv.run();
}