get markdown formatted string from book title
A quick CLI tool to get Markdown formatted strings to be used in the documentation of topshelfie.co. Want to help? Head over to the repo kyro/shelfies.
The final Markdown formatted string looks like this with the book sub/alternate title:
[Why Nations Fail](http://www.amazon.com/Why-Nations-Fail-Origins-Prosperity/dp/0307719227) - *The Origins of Power, Prosperity, and Poverty*
$ npm install --save shelfies-amazon-linker
The Amazon Product Advertising API requires the following credentials to be passed with every single call:
- AWS access key ID -
AWS_ID
- AWS secret access key -
AWS_SECRET
- Amazon associate tag -
AWS_TAG
shelfies-amazon-linker looks for these values in environment variables named: AWS_ID
, AWS_SECRET
and AWS_TAG
.
Please ensure that these are set before running the package.
var shelfiesAmazonLinker = require('shelfies-amazon-linker');
shelfiesAmazonLinker('why nations fail', function(err, result){
if(err){
// handle the error
}
console.log(result);
// => { url: 'http://www.amazon.com/Why-Nations-Fail-Origins-Prosperity/dp/0307719227',
// author: [ 'Daron Acemoglu', 'James Robinson' ],
// title: 'Why Nations Fail',
// subtitle: 'The Origins of Power, Prosperity, and Poverty',
// markdown: '[Why Nations Fail](http://www.amazon.com/Why-Nations-Fail-Origins-Prosperity/dp/0307719227) - *The Origins of Power, Prosperity, and Poverty*' }
});
$ npm install --global shelfies-amazon-linker
The command-line tool joins every parameter into a string, allows the user to omit quotes around the search term.
$ shelfies-amazon-linker --help
Example
shelfies-amazon-linker why nations fail
Looking up: "why nations fail"
Authors: [ 'Daron Acemoglu', 'James Robinson' ]
[Why Nations Fail](http://www.amazon.com/Why-Nations-Fail-Origins-Prosperity/dp/0307719227) - *The Origins of Power, Prosperity, and Poverty*
Copied to your clipboard
MIT © Matias Singers