Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit 4ac5c2d

Browse files
committed
Initial commit.
0 parents  commit 4ac5c2d

File tree

8 files changed

+182
-0
lines changed

8 files changed

+182
-0
lines changed

.eslintrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": [
3+
"@neogeek/eslint-config-standards"
4+
],
5+
"rules": {
6+
"new-cap": 0
7+
}
8+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.eslintrc

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Scott Doxey
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# doxdox-plugin-github-wiki
2+
3+
> GitHub wiki export plugin for doxdox.
4+
5+
[![NPM Version](http://img.shields.io/npm/v/doxdox-plugin-github-wiki.svg?style=flat)](https://www.npmjs.org/package/doxdox-plugin-github-wiki)
6+
7+
## Install
8+
9+
```bash
10+
$ npm install doxdox doxdox-plugin-github-wiki --save-dev
11+
```
12+
13+
## Usage
14+
15+
```bash
16+
$ doxdox 'src/**/*.js' --layout github-wiki --output wiki.zip
17+
```

index.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const Handlebars = require('handlebars');
5+
6+
const admzip = require('adm-zip');
7+
8+
const plugin = data => new Promise((resolve, reject) => {
9+
10+
const zip = new admzip();
11+
12+
fs.readFile(path.join(__dirname, 'template.hbs'), 'utf8', (err, contents) => {
13+
14+
if (err) {
15+
16+
return reject(err);
17+
18+
}
19+
20+
const template = Handlebars.compile(contents);
21+
22+
data.files.forEach(file => {
23+
24+
file.methods.forEach(method => {
25+
26+
zip.addFile(
27+
`${file.name}/${method.name}.md`,
28+
template(method)
29+
);
30+
31+
});
32+
33+
});
34+
35+
return resolve(zip.toBuffer());
36+
37+
});
38+
39+
});
40+
41+
module.exports = plugin;

package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "doxdox-plugin-github-wiki",
3+
"description": "GitHub wiki export plugin for doxdox.",
4+
"version": "1.0.0",
5+
"main": "index.js",
6+
"license": "MIT",
7+
"dependencies": {
8+
"adm-zip": "0.4.7",
9+
"handlebars": "4.0.5"
10+
},
11+
"devDependencies": {
12+
"@neogeek/eslint-config-standards": "1.6.4",
13+
"eslint": "3.8.1"
14+
},
15+
"peerDependencies": {
16+
"doxdox": "^1.1.x"
17+
},
18+
"scripts": {
19+
"test": "echo \"Error: no test specified\" && exit 1"
20+
},
21+
"keywords": [
22+
"doxdox",
23+
"plugin",
24+
"github",
25+
"wiki",
26+
"markdown"
27+
],
28+
"authors": [
29+
{
30+
"name": "Scott Doxey",
31+
"email": "[email protected]",
32+
"homepage": "http://scottdoxey.com/"
33+
}
34+
],
35+
"homepage": "https://github.com/neogeek/doxdox-plugin-github-wiki",
36+
"repository": {
37+
"type": "git",
38+
"url": "git://github.com/neogeek/doxdox-plugin-github-wiki.git"
39+
}
40+
}

template.hbs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# {{name}}({{params}}) {{#if isPrivate}} *private method*{{/if}}
2+
3+
{{{description}}}
4+
5+
{{{body}}}
6+
7+
{{#if tags.param}}
8+
9+
## Parameters
10+
11+
{{#each tags.param}}
12+
- **{{name}}** {{#each types}}`{{.}}` {{/each}} {{#if isOptional}}*Optional*{{/if}} {{{description}}}
13+
{{/each}}
14+
15+
{{/if}}
16+
17+
{{#if tags.property}}
18+
19+
## Properties
20+
21+
{{#each tags.property}}
22+
- **{{name}}** {{#each types}}`{{.}}` {{/each}} {{#if isOptional}}*Optional*{{/if}} {{{description}}}
23+
{{/each}}
24+
25+
{{/if}}
26+
27+
{{#if tags.example}}
28+
29+
## Examples
30+
31+
{{#each tags.example}}
32+
```javascript
33+
{{{.}}}
34+
```
35+
{{/each}}
36+
37+
{{/if}}
38+
39+
## Returns
40+
41+
{{#if tags.return}}
42+
43+
{{#each tags.return}}
44+
- {{#each types}}`{{.}}` {{/each}} {{#if isOptional}}*Optional*{{/if}} {{{description}}}
45+
{{/each}}
46+
47+
{{else}}
48+
49+
- `Void`
50+
51+
{{/if}}
52+
53+
*Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*

0 commit comments

Comments
 (0)