Package Exports
- readme-badger
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (readme-badger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
readme-badger
Whizzy badges in your READMEs.
Install
npm install readme-badger
How To Use
addBadge(content, fileExt, imageUrl, linkUrl, altText)
Returns the content but with a new badge inserted.
content: the text content of a README.fileExt: the file extension of the README (md, textile, rdoc etc).imageUrl: the image url for the badge.linkUrl: the url for the badge to link to.altText: the alternative if images aren't visible. This will be used on its own for plaintext READMEs, so include a url in the text.
hasImageSupport(fileExt)
Returns true/false depending on whether the format (fileExt) will render a badge image or just the altText.
fileExt: the file extension of the README (md, textile, rdoc etc)
Example
var badger = require('readme-badger');
var readme = '# My Lovely Library\n' +
'\n' +
'## Features\n';
var imageUrl = 'https://badges.gitter.im/Join%20Chat.svg';
var linkUrl = 'https://gitter.im/gitterHQ/gitter';
var altText = 'Join the chat at https://gitter.im/gitterHQ/gitter';
var readmeWithBadge = badger.addBadge(readme, 'md', imageUrl, linkUrl, altText);
console.log(readmeWithBadge);
// # My Lovely Library
//
// [](https://gitter.im/gitterHQ/gitter)
//
// ## Features
// ...
Format (fileExt) Support
readme-badger supports almost all of the GitHub README markups:
It will also failover to inserting the altText at the bottom of the README for any format that doesnt have image link support (creole, txt or anything else).
Building Locally
git clone git@github.com:gitterHQ/readme-badger.gitcd readme-badgernpm installnpm test
License
MIT