#console #print #diagnostics #markup #messages #content #printing

rome_console

Expose utilities to print HTML-syntax messages

1 unstable release

0.0.1 Apr 4, 2023

#102 in #diagnostics

Download history 13/week @ 2024-06-28 8/week @ 2024-07-05 28/week @ 2024-07-12 27/week @ 2024-07-19 16/week @ 2024-07-26 19/week @ 2024-08-02 19/week @ 2024-08-09 15/week @ 2024-08-16 14/week @ 2024-08-23 12/week @ 2024-08-30 14/week @ 2024-09-06 15/week @ 2024-09-13 33/week @ 2024-09-20 30/week @ 2024-09-27 8/week @ 2024-10-04 9/week @ 2024-10-11

84 downloads per month
Used in 10 crates (7 directly)

MIT license

65KB
1.5K SLoC

rome_console

The crate contains a general abstraction over printing messages (formatted with markup) and diagnostics to a console.

Local installation

rome_console = { version = "0.0.0", path = "../rome_console" }

Usage example

The Console trait can be used to print two types of information to the user: messages (in the form of markup) and diagnostics:

console.message(markup! {
    <Info>"Processed "<Emphasis>{count}</Emphasis>" files"</Info>
});

console.diagnostic(
    &mut files,
    Diagnostics::error(file_id, code, title),
);

The following markup elements are supported:

  • Emphasis: Print the content in bold text
  • Dim: Print the content in dimmed text
  • Italic: Print the content in italic text
  • Underline: Print the content in underlined text
  • Error: Set the text color to red
  • Success: Set the text color to green
  • Warn: Set the text color to yellow
  • Info: Set the text color to blue

Note: Markup elements that change the "font" of the printed text (Emphasis, Dim, Italic and Underline) are not supported by the native Windows Console API and will instead get printed as ANSI control codes if the current terminal supports it, or will be ignored entirely

Dependencies

~1.2–8.5MB
~65K SLoC