#formatter #linter #parser #text-color

biome_console

Utilities to print messages (formatted with biome_markup) and diagnostics

10 releases (4 breaking)

0.5.7 Mar 12, 2024
0.5.6 Mar 12, 2024
0.4.0 Jan 9, 2024
0.3.1 Nov 26, 2023
0.0.2 Sep 28, 2023

#1024 in Web programming

Download history 6507/week @ 2024-07-24 7621/week @ 2024-07-31 9348/week @ 2024-08-07 5335/week @ 2024-08-14 15128/week @ 2024-08-21 10654/week @ 2024-08-28 12398/week @ 2024-09-04 8836/week @ 2024-09-11 11398/week @ 2024-09-18 12253/week @ 2024-09-25 13868/week @ 2024-10-02 8572/week @ 2024-10-09 13847/week @ 2024-10-16 10272/week @ 2024-10-23 13699/week @ 2024-10-30 5141/week @ 2024-11-06

48,525 downloads per month
Used in 24 crates (16 directly)

MIT/Apache

70KB
1.5K SLoC

biome_console

The crate contains a general abstraction over printing messages (formatted with markup) and diagnostics to a 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.5–8.5MB
~69K SLoC