Created
June 10, 2015 18:10
-
-
Save kevinswiber/b3327eb8cb38494adf67 to your computer and use it in GitHub Desktop.
Generating Zetta docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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