Skip to content

Commit

Permalink
Minor documentation improvements
Browse files Browse the repository at this point in the history
Remove unnecessary full path in top-level example and use cfg_attr with
doc to enable examples in ColourExt when running doctest with ansi_term
feature enabled.
  • Loading branch information
mina86 committed Dec 13, 2022
1 parent e06b5d4 commit c5fcc93
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@
//!
//! fn main() {
//! // Colour at given index:
//! println!("{:-3}: {:?}", 50, ansi_colours::rgb_from_ansi256(50));
//! println!("{:-3}: {:?}", 50, rgb_from_ansi256(50));
//!
//! // Approximate true-colour by colour in the palette:
//! let rgb = (100, 200, 150);
//! let index = ansi256_from_rgb(rgb);
//! println!("{:?} ~ {:-3} {:?}",
//! rgb, index, ansi_colours::rgb_from_ansi256(index));
//! println!("{:?} ~ {:-3} {:?}", rgb, index, rgb_from_ansi256(index));
//! }
//! ```
Expand Down Expand Up @@ -173,7 +172,8 @@ pub trait ColourExt: Sized {
///
/// # Examples
///
/// ```ignore
#[cfg_attr(feature = "ansi_term", doc = "```")]
#[cfg_attr(not(feature = "ansi_term"), doc = "```ignore")]
/// use ansi_colours::ColourExt;
/// use ansi_term::Colour;
///
Expand Down Expand Up @@ -207,7 +207,8 @@ pub trait ColourExt: Sized {
///
/// # Examples
///
/// ```ignore
#[cfg_attr(feature = "ansi_term", doc = "```")]
#[cfg_attr(not(feature = "ansi_term"), doc = "```ignore")]
/// use ansi_colours::ColourExt;
/// use ansi_term::Colour;
///
Expand All @@ -231,7 +232,8 @@ pub trait ColourExt: Sized {
///
/// # Examples
///
/// ```ignore
#[cfg_attr(feature = "ansi_term", doc = "```")]
#[cfg_attr(not(feature = "ansi_term"), doc = "```ignore")]
/// use ansi_colours::ColourExt;
/// use ansi_term::Colour;
///
Expand Down

0 comments on commit c5fcc93

Please sign in to comment.