2 unstable releases

0.2.0 Jun 6, 2021
0.1.0 Oct 7, 2020

#115 in Command-line interface

Download history 8/week @ 2021-02-25 12/week @ 2021-03-04 15/week @ 2021-03-11 11/week @ 2021-03-18 21/week @ 2021-03-25 11/week @ 2021-04-01 9/week @ 2021-04-08 13/week @ 2021-04-15 10/week @ 2021-04-22 12/week @ 2021-04-29 6/week @ 2021-05-06 6/week @ 2021-05-13 15/week @ 2021-05-20 14/week @ 2021-05-27 46/week @ 2021-06-03 21/week @ 2021-06-10

53 downloads per month
Used in rusty-man

Apache-2.0 OR MIT

140KB
412 lines

cursive-markup-rs

The cursive-markup crate provides a markup view for cursive that can render HTML.

Documentation

For example, this page could be rendered like this:

A screenshot of this readme rendered with cursive-markup

Example

// Create the markup view
let html = "<a href='https://rust-lang.org'>Rust</a>";
let mut view = cursive_markup::MarkupView::html(&html);
view.set_maximum_width(120);

// Set callbacks that are called if the link focus is changed and if a link is
// selected with the Enter key
view.on_link_focus(|s, url| {});
view.on_link_select(|s, url| {});

// Add the view to a Cursive instance
use cursive::view::{Resizable, Scrollable};
let mut s = cursive::dummy();
s.add_global_callback('q', |s| s.quit());
s.add_fullscreen_layer(view.scrollable().full_screen());
s.run();

For a complete example, see examples/browser.rs, a very simple browser implementation.

Features

  • html (default): render HTML using html2text

Minimum Supported Rust Version

This crate supports Rust 1.45.0 or later.

Contributing

Contributions to this project are welcome! Please submit patches to the mailing list ~ireas/public-inbox@lists.sr.ht (archive) using the [PATCH cursive-markup-rs] subject prefix. For more information, see the Contributing Guide.

Contact

For bug reports, feature requests and other messages, please send a mail to ~ireas/public-inbox@lists.sr.ht (archive) using the [cursive-markup-rs] prefix in the subject.

License

This project is dual-licensed under the Apache-2.0 and MIT licenses. The documentation and examples contained in this repository are licensed under the Creative Commons Zero license. You can find a copy of the license texts in the LICENSES directory.

cursive-markup-rs complies with version 3.0 of the REUSE specification.

Dependencies

~4.5MB
~81K SLoC