Code Monkey home page Code Monkey logo

monojustifier's Introduction

MonoJustifier

There are many justification algorithms and engines out there, but this one is specifically for the mono width environment like terminal emulators and text editors. One use of this is for a comment justification extension on vscode or in the TextGraphic framework.

I have made this algorithm after years of needing something specifically for monospace environments that is tailored with care to make text look nice there. No algorithm is designed for this purpose and those that do are so basic. I have created a new system that is fast, and very powerful, supporting many important features that were previously non-existent:

  • Last Line Orphan Word Handler
  • Specialized Mono Width Typographical River Elimination
  • Specialized Mono Width Space Balancer
  • Word Breaker for Long Words With Controllable Tolerance Factor
import { MonoJustifier } from '@kary/justifier';
const justifier = new MonoJustifier(40);

const justifiedLines = justifier.justify([
    'Mono Justifier is a text justification engine specially',
    'designed for the mono space environments like terminal',
    'and text editors.'
]);

monojustifier's People

Contributors

pouyakary avatar

Stargazers

Zea avatar Amir Jani avatar

Watchers

 avatar

monojustifier's Issues

Punctuations should be regarded as extra space.

In this example, it adds the extra space afetr the . in the third line. This should not happen as this makes the spacing look extra much. there should be a way to compute against this.

  /// When  editing  a  receipt,  this loads the
  /// receipt and any necessary information  re-
  /// quired,  into the inspector and then opens
  /// the inspector.

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.