Giter VIP home page Giter VIP logo

lyneate's Introduction

Lyneate

crates.io license docs.rs

Display beautiful code reports in the terminal with support for single-line and multi-line highlighting.

test

use colored::Colorize;
use lyneate::Report;

fn main() {
    println!(
        "{} Mismatched match expression branch return types\n",
        "Error:".bright_red()
    );

    let report = Report::new_char_spanned(
        include_str!("basic.pseudo"),
        [
            (
                29..102,
                format!("{}", "In this match expression".dimmed()),
                (255, 64, 112),
            ),
            (
                64..75,
                format!("{} {}", "This is of type".dimmed(), "int".bright_white()),
                (255, 159, 64),
            ),
            (
                87..92,
                format!("{} {}", "This is of type".dimmed(), "string".bright_white()),
                (207, 255, 64),
            ),
        ],
    );

    report.display();
}

More examples

Usage

This crate provides:

  • the Report struct which takes the source code and an iterator over the span, text, and color of all messages
  • the Theme, ThemeChars, ThemeEffects, and ThemeSizing structs which can be used to customize the appearance of a report display

Code spans can be byte-aligned or char-aligned. Different methods for constructing a Report for either are provided.

The API is kept simple in order to allow as much flexibility as possible to the user. It does not make any assumptions or care about the provenance of the source code.

Planned Features

  • Colorless support.

lyneate's People

Contributors

flowvix avatar

Stargazers

Alexander Simonov avatar Kurenshe Nurdaulet avatar Nick DeMonner avatar Gabriel Juan avatar mat avatar koutsie avatar Specky avatar incredimo avatar GGodPL avatar eightfold avatar SpaghettDev avatar dood avatar Lucas Alves Rego avatar JG03dev avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.