UNPKG

5.02 kBMarkdownView Raw
1# [doxdox](https://github.com/neogeek/doxdox) *3.0.0*
2
3> JSDoc to Markdown, Bootstrap, and custom Handlebars template documentation generator.
4
5
6### lib/doxdox.js
7
8
9#### parseFile(input, config)
10
11Parse a file with custom parser.
12
13 parseFile('src/main.js', {'parser': 'dox'}).then(files => {});
14
15
16
17
18##### Parameters
19
20| Name | Type | Description | |
21| ---- | ---- | ----------- | -------- |
22| input | `String` | File to parse. |   |
23| config | `Object` | Configuration object. |   |
24| config.parser | `String` | String representing the parser to be used. |   |
25
26
27
28
29##### Returns
30
31
32- `Object` Promise
33
34
35
36#### parseFiles(inputs, config)
37
38Parse array of files, and then render the parsed data through the defined layout plugin.
39
40 parseFiles(['src/main.js'], {'ignore': [], 'parser': 'dox', 'layout': 'markdown'}).then(content => {});
41
42
43
44
45##### Parameters
46
47| Name | Type | Description | |
48| ---- | ---- | ----------- | -------- |
49| inputs | `Array` | Array of directory globs and/or files. |   |
50| config | `Object` | Configuration object. |   |
51| config.ignore | `String` | Array of paths to ignore. |   |
52| config.parser | `String` | String representing the parser to be used. |   |
53| config.layout | `String` | String representing the layout plugin to be used. |   |
54
55
56
57
58##### Returns
59
60
61- `Object` Promise
62
63
64
65#### parseInputs(inputs, config)
66
67Parse array of directory globs and/or files, and then render the parsed data through the defined layout plugin.
68
69 parseInputs(['src/*.js'], {'ignore': [], 'parser': 'dox', 'layout': 'markdown'}).then(content => {});
70
71
72
73
74##### Parameters
75
76| Name | Type | Description | |
77| ---- | ---- | ----------- | -------- |
78| inputs | `Array` | Array of directory globs and/or files. |   |
79| config | `Object` | Configuration object. |   |
80| config.ignore | `String` | Array of paths to ignore. |   |
81| config.parser | `String` | String representing the parser to be used. |   |
82| config.layout | `String` | String representing the layout plugin to be used. |   |
83
84
85
86
87##### Returns
88
89
90- `Object` Promise
91
92
93
94
95### lib/loaders.js
96
97
98#### findPackagePath(pkg) *private method*
99
100Find which node_modules directory to load package from.
101
102 findPackagePath('doxdox-parser-dox').then(parser => {});
103 findPackagePath('doxdox-plugin-bootstrap').then(plugin => {});
104
105
106
107
108##### Parameters
109
110| Name | Type | Description | |
111| ---- | ---- | ----------- | -------- |
112| pkg | `String` | Package name as string. |   |
113
114
115
116
117##### Returns
118
119
120- `Object` Promise
121
122
123
124#### loadParser(config) *private method*
125
126Load parser based on user defined choice.
127
128 loadParser({'parser': 'dox'}).then(parser => {});
129 loadParser({'parser': 'parser.js'}).then(parser => {});
130
131
132
133
134##### Parameters
135
136| Name | Type | Description | |
137| ---- | ---- | ----------- | -------- |
138| config | `Object` | Configuration object. |   |
139| config.parser | `String` | String representing the parser to be loaded. |   |
140
141
142
143
144##### Returns
145
146
147- `Object` Promise
148
149
150
151#### loadPlugin(config) *private method*
152
153Load layout plugin based on user defined choice.
154
155 loadPlugin({'layout': 'markdown'}).then(plugin => {});
156 loadPlugin({'layout': 'templates/README.hbs'}).then(plugin => {});
157 loadPlugin({'layout': 'plugin.js'}).then(plugin => {});
158
159
160
161
162##### Parameters
163
164| Name | Type | Description | |
165| ---- | ---- | ----------- | -------- |
166| config | `Object` | Configuration object. |   |
167| config.layout | `String` | String representing the layout plugin to be loaded. |   |
168
169
170
171
172##### Returns
173
174
175- `Object` Promise
176
177
178
179
180### lib/utils.js
181
182
183#### findPackageFileInPath([input])
184
185Finds package.json file from either the directory the script was called from or a supplied path.
186
187 console.log(findPackageFileInPath());
188 console.log(findPackageFileInPath('./package.json'));
189 console.log(findPackageFileInPath('~/git/github/doxdox/'));
190
191
192
193
194##### Parameters
195
196| Name | Type | Description | |
197| ---- | ---- | ----------- | -------- |
198| input | `String` | Directory or file. | *Optional* |
199
200
201
202
203##### Returns
204
205
206- `String` Path to package.json file.
207
208
209
210#### formatPathsArrayToIgnore(paths)
211
212Format an array of directories and/or files to be ignored by globby by adding a "!" at the beginning of each path.
213
214 console.log(formatPathsArrayToIgnore(['./src']));
215
216
217
218
219##### Parameters
220
221| Name | Type | Description | |
222| ---- | ---- | ----------- | -------- |
223| paths | `Array` | Array of directories and/or files. |   |
224
225
226
227
228##### Returns
229
230
231- `Array` Modified array of directories and/or files.
232
233
234
235#### setConfigDefaults(config)
236
237Sets default configuration values.
238
239 console.log(setConfigDefaults({}));
240
241
242
243
244##### Parameters
245
246| Name | Type | Description | |
247| ---- | ---- | ----------- | -------- |
248| config | `Object` | Custom configuration object. |   |
249
250
251
252
253##### Returns
254
255
256- `Object` Modified configuration object.
257
258
259
260
261*Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*