textpresentation
v1.4.5
Published
Text presention program on command line
Downloads
396
Readme
tpt
Text presention program on command line.
This program is inspired from tpp.
Contents
Installation
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 [email protected]:HARDY8118/tpt.git
cd tpt
yarn install
yarn run build
yarn link
Usage
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
Controls
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 |
Slides
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
}
}
]
}
Writing slides
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.
Line
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 |
List
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
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 |
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 |
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
|
Hchart
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
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 |
Timming
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 |
Contributing
Refer to CONTRIBUTING.md for instructions on how to contribute.
Other Projects
A list of projects which can be useful for making text based presentations.