Text presention program on command line.
This program is inspired from tpp.
The program can be installed using npm/yarn.
yarn global add textpresentation # yarn
# OR
npm install -g textpresentation # npm
OR
Compile from source
git clone git@github.com:HARDY8118/tpt.git
cd tpt
yarn install
yarn run build
yarn link
The program can be used to display presentations from using only command line. To open a presentation use the command line utility and provide with location of presentation
tpt presentation
Once presentation is started, use the following keys to navigate
Key | Function |
---|---|
Down, Right, K, L | Go to next slide |
Up, Left, J, H | Go back to previous slide |
Esc | End presentation |
Presentations can be created using any text editor and are defined using JSON standard.
{
"meta": {
"author": "<author name/email/info>",
},
"config": {
"min-width": 100,
},
"slides":[
{
"title": "<Slide title>",
"content": [
{"type":"text", "text": "content"},
{"type":"line", "style": "-"},
],
"timming": {
"NextAfter": 4
}
}
]
}
Slides can be defined as an array of object, each object holds type and specific properties associated with it.
Following items can be used in slides.
Draw line
{
"type": "line",
"width": 50,
"style": "-"
}
Property | Required | Type | Default value | Description |
---|---|---|---|---|
type | ✓ | String | "line" | Specifies type |
width | ✗ | Number | <terminal width> | Width of line in charactters |
style | ✗ | String | "-" | Line style using (length 1 or 3) |
1 Use same character throughtout | ||||
3 1st and 3rd characters on sides, 2nd in minddle |
Show bullet list
{
"type": "list",
"items" [ "item1", "item2", "item3" ]
"style": "> ",
"margin": 0,
"heading": "Items"
}
Property | Required | Type | Default value | Description |
---|---|---|---|---|
type | ✓ | String | "list" | Specifies type |
items | ✓ | String[] | List items | |
style | ✗ | String | "> " | Bullet style |
margin | ✗ | Number | 0 | Left margin for list |
heading | ✗ | String | "" | List heading |
Figlet can be used to draw large font ascii text.
Internally this program uses figlet package to draw figlet.
Refer figlet documentation for figlet options.
{
"type": "figlet",
"text" "figlet"
"options": {},
}
Property | Required | Type | Default value | Description |
---|---|---|---|---|
type | ✓ | String | "figlet" | Specifies type |
text | ✓ | String | Figlet text | |
options | ✗ | Figlet Options | {} | Options for figlet text |
Show plain text
{
"type": "text",
"text": "sample text",
"align": "left",
"style": {
"textColor": "black",
"backgroundColor": "bgWhite",
"styles": ["bold", "underline"]
}
}
Property | Required | Type | Default value | Description |
---|---|---|---|---|
type | ✓ | String | "text" | Specifies type |
text | ✓ | String | Text to display | |
align | ✗ | String | "left" | Text alignment |
style | ✗ | Object | Text style properties |
Property | Description | Enum |
---|---|---|
textColor | Foreground text color | black red green yellow blue magenta cyan white gray grey |
backgroundColor | Background color of text | bgBlack bgRed bgGreen bgYellow bgBlue bgMagenta bgCyan bgWhite |
styles | List of formatting styles | bold dim italic underline inverse hidden strikethrough |
Show horizontal bar chart
{
"type": "hchart",
"items": [
["item1", 1],
["item2", 2],
["item3", 3]
],
"showValues": true,
"style": "■"
}
Property | Required | Type | Default value | Description |
---|---|---|---|---|
type | ✓ | String | "text" | Specifies type |
items | ✓ | [[String, Number]] | Items and values | |
showValues | ✗ | Boolean | true | Show absolute values |
style | ✗ | String | "■" | Chart style |
Code segment with highlighting
{
"type": "code",
"lang": "",
"code": [
"console.log('Hello');"
]
}
Property | Required | Type | Default value | Description |
---|---|---|---|---|
type | ✓ | String | "text" | Specifies type |
lang | ✗ | String | undefined | Language of code (can be empty) |
code | ✓ | String[] | true | Code to dispay, each line as array item |
Additionally a timming object can be provided with slide to control timming of slide. The supported properties are:
Property | Type | Description |
---|---|---|
NextAfter | Number | Scroll to next page after specified seconds |
Refer to CONTRIBUTING.md for instructions on how to contribute.
A list of projects which can be useful for making text based presentations.