Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/johno/shtml

[WIP] Style shell output in an html-like fashion
https://github.com/johno/shtml

Last synced: 3 months ago
JSON representation

[WIP] Style shell output in an html-like fashion

Awesome Lists containing this project

README

        

# shtml [![Build Status](https://secure.travis-ci.org/johnotander/shtml.svg?branch=master)](https://travis-ci.org/johnotander/shtml) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

Style shell output in an html-like fashion.
This library draws inspiration from [chx](https://github.com/zeit/chx) but differs because it uses JavaScript template literals.

Requires no transpilation or babelscript.

## Installation

```bash
npm install --save shtml
```

## Usage

```javascript
const shtml = require('shtml')

console.log(shtml`


  • Item A

  • Item B


`)

console.log(shtml`

Hello, world!

This is pretty neat.

`)
```

#### Supported tags

Tag | Usage | Description
--- | --- | -----------
`

` | `

...

` | Wrapper for text, adds a new line to the end
`
` | `
` | Adds a newline
`
` | `
` | Adds a horizontal rule
`
    ` | `

    • Item A

    • Item B

    ` | Adds an unordered list with bullet points
    `` | `...` | Color the text, see the [supported colors](#colors) below
    `` | `...` | Color the background of text, see the [supported colors](#colors) below
    `` | `...` | Get rainbow colored text

    #### Colors

    In order to color console text, `shtml` uses [`chalk`](https://npmjs.com/package/chalk).
    The following colors are supported:

    - black
    - red
    - green
    - yellow
    - blue
    - magenta
    - cyan
    - white
    - gray

    ## License

    MIT

    ## Contributing

    1. Fork it
    2. Create your feature branch (`git checkout -b my-new-feature`)
    3. Commit your changes (`git commit -am 'Add some feature'`)
    4. Push to the branch (`git push origin my-new-feature`)
    5. Create new Pull Request

    Crafted with <3 by John Otander ([@4lpine](https://twitter.com/4lpine)).

    ***

    > This package was initially generated with [yeoman](http://yeoman.io) and the [p generator](https://github.com/johnotander/generator-p.git).