jacksoncougar / TOM

Terminal document Object Model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terminal document Object Model

The Terminal document Object Model (TOM) is an experiment to get html and css like output for the terminal, or other plaintext streams.

example1
Figure 1. Example output of the library

Version #1

Features
  • Long lines are wrapped to fit within the Element.

  • Lines can be justified within the element: right, center, or left justification.

  • Borders can be added to elements

  • Both padding and margin can be set per element.

  • Properties are inherited from parent elements

  • margin: 'auto' can be used to center fixed sized element within the document.

  • width: new Percent(50) will calculate the element width based on the parent’s width.

Supported inline properties:
width

{ ch, %, ? }

margin

{ ch, auto }

padding

{ ch }

border

{ solid }

text-align

{ left, center, right }

ch

character absolute units

%

percent relative units

?

inherited units

Debugging

Version 1 supports a debug flag for rendering the padding and alignment characters with ansi escape-sequence colours.

debug example

About

Terminal document Object Model


Languages

Language:TypeScript 100.0%