Skip to content

Instantly share code, notes, and snippets.

@kevinswiber
Created June 10, 2015 18:10
Show Gist options
  • Select an option

  • Save kevinswiber/b3327eb8cb38494adf67 to your computer and use it in GitHub Desktop.

Select an option

Save kevinswiber/b3327eb8cb38494adf67 to your computer and use it in GitHub Desktop.
Generating Zetta docs
var marked = require('marked');
var siren = require('siren');
marked.setOptions({
gfm: true
});
var root = 'http://localhost:1337/';
siren()
.load(root)
.link('http://rels.zettajs.io/server')
.link('http://rels.zettajs.io/metadata')
.map(function(env) {
var docs = [];
env.response.body.entities.forEach(function(entity) {
if (entity.properties.documentation) {
docs.push(entity.properties.documentation);
}
});
return docs.join('\n');
})
.subscribe(function(doc) {
console.log(marked(doc));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment