GithubHelp home page GithubHelp logo

typst-fmt's Introduction

The crate is published with empty Typst

Howdy! This is a formatter for the Typst language!

Features

Basic non configurable formatting.

Contributing

Contributing via feature request and issue

To push this formatter further, I need to know what you don't like.

You can :

  • request features (something you'd like configurable)
  • open an issue with a snippet of code that is not formatted how you'd like it.

Contributing to the Code Base

The formatting is done using Rules:

pub(crate) trait Rule: std::fmt::Debug {
    fn accept(&self, syntax_node: &SyntaxNode, context: &Context) -> bool;

    fn eat(&self, text: String, context: &Context, writer: &mut Writer);

    fn as_dyn(self: Self) -> Box<dyn Rule>
    where
        Self: Sized + 'static,
    {
        Box::new(self)
    }
}

To contribute you could:

  • Choose an ignored test and make it pass, this will often require you to ad or modify a rule or the order in which they are applied. Sometimes you'll have to modify the Context struct.
  • Add a test containing an interesting snippet of code. It will usually look like this:
test_snippet!(
    no_apply_if_not_in_code_block,
    ignore = "unimplemented",
    expect = "#f()",
    "#f()",
    &[IdentItemFunc.as_dyn()]
);

If there is no open issue, discussion before opening a pull requests is appreciated.

typst-fmt's People

Contributors

astrale-sharp avatar nachiketkanore avatar dvdvgt 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.