-
Notifications
You must be signed in to change notification settings - Fork 152
/
Copy pathcli-data.js
248 lines (244 loc) · 7.66 KB
/
cli-data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/* generation options */
const jsdocDefinitions = [
{
name: 'files',
alias: 'f',
type: String,
multiple: true,
defaultOption: true,
description: 'A list of jsdoc explain files (or glob expressions) to parse for documentation. Either this or {bold --source} must be supplied.',
typeLabel: '{underline file} ...'
},
{
name: 'source',
type: String,
description: 'A string containing source code to parse for documentation. Either this or {bold --files} must be supplied.'
},
{
name: 'configure',
alias: 'c',
type: String,
typeLabel: '{underline file}',
description: 'Path to a jsdoc configuration file, passed directly to `jsdoc -c`.'
},
{
name: 'namepaths',
type: Boolean,
description: 'Print namepaths.'
}
]
const jsdoc2mdDefinitions = [
{
name: 'help',
description: 'Print usage information',
alias: 'h',
type: Boolean
},
{
name: 'config',
description: 'Print all options supplied (from command line, `.jsdoc2md.json` or `package.json` under the `jsdoc2md` property) and exit. Useful for checking the tool is receiving the correct config.',
type: Boolean
},
{
name: 'json',
type: Boolean,
description: 'Prints the data (jsdoc-parse output) supplied to the template (dmd).'
},
{
name: 'jsdoc',
type: Boolean,
description: 'Prints the raw jsdoc data.'
},
{ name: 'version', type: Boolean },
{
name: 'no-cache',
type: Boolean,
description: 'By default, repeat invocations against the same input with the same options returns from cache. This option disables that. '
},
{
name: 'clear',
type: Boolean,
description: 'Clears the cache.'
}
]
const dmdDefinitions = [
{
name: 'template',
alias: 't',
type: String,
typeLabel: '<file>',
description: 'A custom handlebars template file to insert documentation into. The default template is `\\{\\{>main\\}\\}`.'
},
{
name: 'private',
type: Boolean,
description: 'Include identifiers marked {bold @private} in the output'
},
{
name: 'heading-depth',
type: Number,
alias: 'd',
description: 'Root markdown heading depth, defaults to 2 ({bold ##}).'
},
{
name: 'plugin',
type: String,
typeLabel: '{underline module} ...',
multiple: true,
description: 'Use an installed package containing helper and/or partial overrides.'
},
{
name: 'helper',
type: String,
typeLabel: '{underline module} ...',
multiple: true,
description: 'Handlebars helper modules to override or extend the default set.'
},
{
name: 'partial',
type: String,
typeLabel: '{underline file} ...',
multiple: true,
description: 'Handlebars partial files to override or extend the default set.'
},
{
name: 'example-lang',
type: String,
alias: 'l',
description: 'Specifies the default language used in {bold @example} blocks (for syntax-highlighting purposes). In the default gfm mode, each {bold @example} is wrapped in a fenced-code block. Example usage: {bold --example-lang js}. Use the special value {bold none} for no specific language. While using this option, you can override the supplied language for any {bold @example} by specifying the {bold @lang} subtag, e.g {bold @example @lang hbs}. Specifying {bold @example @lang off} will disable code blocks for that example.'
},
{ name: 'name-format', type: Boolean, description: 'Format identifier names as code (i.e. wrap function/property/class etc names in backticks).' },
{
name: 'no-gfm',
type: Boolean,
description: 'By default, dmd generates github-flavoured markdown. Not all markdown parsers render gfm correctly. If your generated docs look incorrect on sites other than Github (e.g. npmjs.org) try enabling this option to disable Github-specific syntax. '
},
{
name: 'separators',
type: Boolean,
description: 'Put {bold <hr>} breaks between identifiers. Improves readability on bulky docs. '
},
{
name: 'module-index-format',
type: String,
alias: 'm',
description: 'When muliple modules are found in the input source code, an index is generated. It can be styled by one of the following options: {bold none}, {bold grouped}, {bold table} or {bold dl}.'
},
{
name: 'global-index-format',
type: String,
alias: 'g',
description: 'When muliple global-scope identifiers are found in the input source code, an index is generated. It can be styled by one of the following options: {bold none}, {bold grouped}, {bold table} or {bold dl}.'
},
{
name: 'param-list-format',
type: String,
alias: 'p',
description: 'Two options to render {bold @param} lists: {bold list} or {bold table} (default). Table format works well in most cases but switch to {bold list} if things begin to look crowded. '
},
{
name: 'property-list-format',
type: String,
alias: 'r',
description: 'Two options to render {bold @property} lists: {bold list} or {bold table} (default).'
},
{
name: 'member-index-format',
type: String,
description: 'Two options to render member lists: {bold list} or {bold grouped} (default). The {bold list} view is loosely-based on the nodejs docs.'
},
{
name: 'clever-links',
type: Boolean,
description: 'By default, all {bold \\{@link\\}} tags are rendered in plain text. If `--clever-links` is set, URL \\{@link\\} tags are rendered in plain text, otherwise monospace.'
},
{
name: 'monospace-links',
type: Boolean,
description: 'By default, all {bold \\{@link\\}} tags are rendered in plain text. If `--monospace-links` is set, all links are rendered in monospace format. This setting is ignored if {bold `--clever-links`} is set.'
},
{
name: 'EOL',
type: String,
description: 'Specify ether `posix` or `win32`. Forces all line endings in the dmd output to use the specified EOL character.'
}
]
/* mix in the jsdoc-parse and dmd options */
const definitions = jsdocDefinitions
.map(def => {
def.group = 'jsdoc'
return def
})
.concat(jsdoc2mdDefinitions.map(def => {
def.group = 'jsdoc2md'
return def
}))
.concat(dmdDefinitions.map(function (def) {
def.group = 'dmd'
return def
}))
export default {
definitions: definitions,
usageSections: [
{
header: 'jsdoc-to-markdown',
content: 'Generates markdown documentation from jsdoc-annotated source code.'
},
{
header: 'Synopsis',
content: [
{
cmmd: '$ jsdoc2md <jsdoc-options> [<dmd-options>]'
},
{
cmmd: '$ jsdoc2md <jsdoc-options> {bold --jsdoc}'
},
{
cmmd: '$ jsdoc2md <jsdoc-options> {bold --json}'
},
{
cmmd: '$ jsdoc2md <jsdoc-options> {bold --namepaths}'
},
{
cmmd: '$ jsdoc2md {bold --help}'
},
{
cmmd: '$ jsdoc2md {bold --config}'
}
]
},
{
header: 'General options',
content: 'Main options affecting mode. If none of the following are supplied, the tool will generate markdown docs.'
},
{
optionList: jsdoc2mdDefinitions
},
{
header: 'jsdoc options',
content: 'Options regarding the input source code, passed directly to jsdoc.'
},
{
optionList: jsdocDefinitions,
},
{
header: 'dmd',
content: 'These options affect how the markdown output looks.'
},
{
optionList: definitions,
group: 'dmd',
tableOptions: {
maxWidth: Math.min(process.stdout.columns, 100)
}
},
{
content: [
{
col1: 'Project repository:',
col2: '{underline https://github.com/jsdoc2md/jsdoc-to-markdown}'
}
]
}
]
}