shtml

0.1.0 • Public • Published

shtml Build Status js-standard-style

Style shell output in an html-like fashion. This library draws inspiration from chx but differs because it uses JavaScript template literals.

Requires no transpilation or babelscript.

Installation

npm install --save shtml

Usage

const shtml = require('shtml')
 
console.log(shtml`
  <ul>
    <li>Item <red>A</red></li>
    <li>Item <rainbow>B</rainbow></li>
  </ul>
`)
 
console.log(shtml`
  <span>
    <rainbow>Hello, world!</rainbow><br>
    <underline>This is pretty neat.</underline>
  </span>
`)

Supported tags

Tag Usage Description
<p> <p>...</p> Wrapper for text, adds a new line to the end
<br> <br> Adds a newline
<hr> <hr> Adds a horizontal rule
<ul> <ul><li>Item A</li><li>Item B</li></ul> Adds an unordered list with bullet points
<color> <red>...</red> Color the text, see the supported colors below
<bgcolor> <bgcyan>...</bgcyan> Color the background of text, see the supported colors below
<rainbow> <rainbow>...</rainbow> Get rainbow colored text

Colors

In order to color console text, shtml uses 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).


This package was initially generated with yeoman and the p generator.

Readme

Keywords

none

Package Sidebar

Install

npm i shtml

Weekly Downloads

2

Version

0.1.0

License

MIT

Last publish

Collaborators

  • johno