mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-10 03:10:41 +00:00
30 lines
719 B
Rust
30 lines
719 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();
|
|
|
|
// If markdown is enabled, parse a small text.
|
|
|
|
#[cfg(feature = "markdown")]
|
|
let text = markdown::parse("Isn't *that* **cool**?");
|
|
|
|
#[cfg(not(feature = "markdown"))]
|
|
let text = "Rebuild with --features markdown ;)";
|
|
|
|
// TextView can natively accept StyledString.
|
|
siv.add_layer(
|
|
Dialog::around(TextView::new(text)).button("Hell yeah!", |s| s.quit()),
|
|
);
|
|
|
|
siv.run();
|
|
}
|