Skip to main content

Crate rich_lumis

Crate rich_lumis 

Source
Expand description

The lumis syntax highlighter for the rich Rust port.

LumisHighlighter is a CodeHighlighter: tree-sitter grammars for parsing, and lumis’s Neovim themes (monokai by default, dracula, github_light, onedark and over 250 more) for colour. Like the built-in syntect adapter it also has ansi_dark and ansi_light, upstream rich’s themes in the terminal’s own 16 colours.

Give it to Syntax or Markdown directly, or register LumisPlugin with a plugin host so it can be chosen by name ("lumis").

use rich::syntax::Syntax;
use rich::Console;
use rich_lumis::LumisHighlighter;

let console = Console::builder().width(40).force_terminal(true).build();
let code = Syntax::new("fn main() {}", "rust")
    .highlighter(LumisHighlighter::shared())
    .theme("dracula");
assert!(console.render_to_string(&code).contains("main"));

lumis compiles every language it ships by default. For a smaller build, turn default features off and pick a bundle (bundle-web, bundle-system, bundle-backend, bundle-web-extra).

Structs§

LumisHighlighter
Syntax highlighting by lumis.
LumisPlugin
Registers LumisHighlighter as the code highlighter "lumis".

Constants§

DEFAULT_THEME
The theme used when none is chosen: upstream rich’s default, monokai.