Skip to content

Instantly share code, notes, and snippets.

@serby
Created January 8, 2014 16:32
Show Gist options
  • Select an option

  • Save serby/8319684 to your computer and use it in GitHub Desktop.

Select an option

Save serby/8319684 to your computer and use it in GitHub Desktop.
Trello to MD in node.js
var Trello = require('node-trello')
, t = new Trello('KEY', 'TOKEN')
t.get('/1/boards/bdLKstEV', function(err, data) {
if (err) throw err
console.log('#', data.name, '\n')
console.log('[Source Trello Board](%s)',data.url)
console.log(data.desc, '\n')
t.get('/1/boards/bdLKstEV/lists?cards=open', function(err, data) {
if (err) throw err
listsToMd(data)
})
})
function listsToMd(data) {
data.forEach(listToMd)
}
function listToMd(list) {
console.log('##', list.name, '\n')
list.cards.forEach(cardToMd)
}
function cardToMd(card) {
console.log('###', card.name, '\n')
if (card.desc) console.log(card.desc, '\n')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment