An open API service indexing awesome lists of open source software.

https://github.com/pouyakary/monojustifier

A justification algorithm specifically designed for monospace environments like terminal emulators and text editors.
https://github.com/pouyakary/monojustifier

ascii-art justification monospace monospaced terminal text-justification text-justify

Last synced: 2 months ago
JSON representation

A justification algorithm specifically designed for monospace environments like terminal emulators and text editors.

Awesome Lists containing this project

README

        

# 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

```ts
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.'
]);
```