Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/douglasduteil/ngdoc-formatter
Populate a template with ngdoc parsed data. (using ngdoc-parser)
https://github.com/douglasduteil/ngdoc-formatter
Last synced: 25 days ago
JSON representation
Populate a template with ngdoc parsed data. (using ngdoc-parser)
- Host: GitHub
- URL: https://github.com/douglasduteil/ngdoc-formatter
- Owner: douglasduteil
- License: wtfpl
- Created: 2014-08-25T16:40:00.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-02-23T15:27:26.000Z (almost 7 years ago)
- Last Synced: 2024-04-13T16:16:58.050Z (8 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ngdoc-formatter [![NPM version][npm-image]][npm-url]
> Populate a template with ngdoc parsed data. (using [ngdoc-parser](https://github.com/douglasduteil/ngdoc-parser))
Get your ngdoc steady and ready to go!
## Install
```sh
$ npm install --save-dev ngdoc-formatter
```## Usage
```js
var fs = require('vinyl-fs');
var path = require('path');
var through = require('through2');var ngdocFormatter = require('ngdoc-formatter');
fs.src('./compiled-doc/*.json')
.pipe(ngdocFormatter())
.pipe(through.obj(function(file, e, callback){
file.path = path.join(file.base, 'api.md');
callback(null, file);
}))
.pipe(fs.dest('./doc'));
```## API
### ngdocFormatter(options)
#### options
##### template
Type: `string`
Default: `ngdocFormatter.defaultMarkdownTemplate`The [nunjucks](http://mozilla.github.io/nunjucks) template to process with the ngdoc data.
###### Built-in templates
- `ngdocFormatter.defaultMarkdownTemplate` (see [defaultTemplates/ngdoc.md.nunjucks](https://github.com/douglasduteil/ngdoc-formatter/blob/master/defaultTemplates/ngdoc.md.nunjucks))
##### ngdocSectionsOrder
Type: `string[]`
Default: `changed.defaultNgdocSectionsOrder`Describe the order in which each grouped `@ngdoc` type will be describe in the final template.
The default order is `changed.defaultNgdocSectionsOrder` :1. function
2. directive
3. object
4. type
5. service
6. provider
7. filter## Play well with [ngdoc-parser](https://github.com/douglasduteil/ngdoc-parser)
```js
var fs = require('vinyl-fs');
var path = require('path');
var through = require('through2');var ngdocParser = require('ngdoc-parser');
var ngdocFormatter = require('ngdoc-formatter');fs.src('./src/*.js')
.pipe(ngdocParser())
.pipe(ngdocFormatter())
.pipe(through.obj(function(file, e, callback){
file.path = path.join(file.base, 'api.md');
callback(null, file);
}))
.pipe(fs.dest('./out'));
```## License
Copyright © 2014 Douglas Duteil
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See the LICENCE file for more details.[npm-url]: https://npmjs.org/package/ngdoc-formatter
[npm-image]: http://img.shields.io/npm/v/ngdoc-formatter.svg