Narwhals Playing Mahjong
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

rich-message

1.0.2 • Public • Published

rich-message

Turn a plain message into a rich HTML message

npm travis

Install

npm install rich-message

Usage

var richMessage = require('rich-message')
var basicMessage = {
  text: 'hi maxogden', // text entered by a user
  username: 'mafintosh', // github username
  timestamp: Date.now()
}
var username = 'maxogden' // current user's github username (used for highlighting)
 
var output = richMessage(basicMessage, username)
// { text: 'hi maxogden',
//   username: 'mafintosh',
//   timestamp: 1458939703123,
//   anon: false,
//   avatar: 'https://github.com/mafintosh.png',
//   timeago: '2:01 PM',
//   html: '<div class="highlight"><p>hi maxogden</p><p></p></div>' }

This module is currently very tightly coupled with friends (sorry). If you'd like to help make it more usable for other projects, please fork and contribute!

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

MIT

install

npm i rich-message

Downloadsweekly downloads

10

version

1.0.2

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability