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

Commit e16117b

Browse files
committed
Initial commit.
0 parents  commit e16117b

File tree

13 files changed

+237
-0
lines changed

13 files changed

+237
-0
lines changed

.eslintrc

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

.gitignore

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

.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
test/
2+
3+
.eslintrc
4+
5+
.travis.yml
6+
7+
Makefile

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: node_js
2+
node_js:
3+
- "4"
4+
- "5"
5+
- "6"
6+
- "7"
7+
before_install:
8+
- if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi
9+
- npm install doxdox -g
10+
after_success:
11+
- bash <(curl -s https://codecov.io/bash)
12+
sudo: false

DOCUMENTATION.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# [doxdox-plugin-example](https://github.com/neogeek/doxdox-plugin-example) *1.0.0*
2+
3+
> Example template plugin for doxdox.
4+
5+
6+
### index.js
7+
8+
9+
#### plugin(data)
10+
11+
Example template plugin for doxdox.
12+
13+
14+
15+
16+
##### Parameters
17+
18+
| Name | Type | Description | |
19+
| ---- | ---- | ----------- | -------- |
20+
| data | `Array` | Methods parsed using a doxdox parser. | &nbsp; |
21+
22+
23+
24+
25+
##### Examples
26+
27+
```javascript
28+
parseInputs(inputs, {'parser': 'dox', 'layout': 'example'}).then(content => console.log(content));
29+
```
30+
31+
32+
##### Returns
33+
34+
35+
- `Promise` Promise with generated content.
36+
37+
38+
39+
40+
*Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*

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.

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
BIN=node_modules/.bin
2+
3+
test:
4+
make lint
5+
doxdox index.js --layout markdown | diff DOCUMENTATION.md -
6+
doxdox index.js --layout index.js | diff test/fixtures/documentation.html -
7+
8+
lint:
9+
$(BIN)/eslint index.js
10+
$(BIN)/eslint helpers.js
11+
12+
fixtures:
13+
doxdox index.js --layout index.js --output test/fixtures/documentation.html
14+
15+
docs:
16+
doxdox index.js --layout markdown --output DOCUMENTATION.md
17+
18+
.PHONY: test

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# doxdox-plugin-example
2+
3+
> Example template plugin for doxdox.
4+
5+
[![Build Status](https://travis-ci.org/neogeek/doxdox-plugin-example.svg?branch=master)](https://travis-ci.org/neogeek/doxdox-plugin-example)
6+
[![NPM Version](http://img.shields.io/npm/v/doxdox-plugin-example.svg?style=flat)](https://www.npmjs.org/package/doxdox-plugin-example)
7+
[![Latest Documentation](https://doxdox.org/images/badge-flat.svg)](https://doxdox.org/neogeek/doxdox-plugin-example)
8+
9+
## Install
10+
11+
```bash
12+
$ npm install doxdox @neogeek/doxdox-plugin-example --save-dev
13+
```
14+
15+
## Usage
16+
17+
```bash
18+
$ doxdox 'src/**/*.js' --layout example --output docs/index.html
19+
```

helpers.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const Handlebars = require('handlebars');
2+
3+
const hljs = require('highlight.js');
4+
const markdown = require('markdown-it')({
5+
highlight (code) {
6+
7+
return hljs.highlight('javascript', code).value;
8+
9+
},
10+
'html': true,
11+
'linkify': true
12+
});
13+
14+
Handlebars.registerHelper('highlightBlock', block => {
15+
16+
if (block) {
17+
18+
return hljs.highlight('javascript', block).value;
19+
20+
}
21+
22+
return null;
23+
24+
});
25+
26+
Handlebars.registerHelper('markdown', block => {
27+
28+
if (block) {
29+
30+
return markdown.render(block);
31+
32+
}
33+
34+
return null;
35+
36+
});

index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const Handlebars = require('handlebars');
5+
6+
require('./helpers');
7+
8+
/**
9+
* Example template plugin for doxdox.
10+
*
11+
* @example parseInputs(inputs, {'parser': 'dox', 'layout': 'example'}).then(content => console.log(content));
12+
* @param {Array} data Methods parsed using a doxdox parser.
13+
* @return {Promise} Promise with generated content.
14+
* @public
15+
*/
16+
17+
const plugin = data => new Promise((resolve, reject) => {
18+
19+
fs.readFile(path.join(__dirname, 'template.hbs'), 'utf8', (err, contents) => {
20+
21+
if (err) {
22+
23+
return reject(err);
24+
25+
}
26+
27+
const template = Handlebars.compile(contents);
28+
29+
return resolve(template(data));
30+
31+
});
32+
33+
});
34+
35+
module.exports = plugin;

0 commit comments

Comments
 (0)