-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
96 lines (84 loc) · 2.74 KB
/
index.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
// eslint-disable-next-line node/no-missing-require
const { ParameterType } = require('typedoc/dist/lib/utils/options/declaration');
const CreateFilePlugin = require('./plugin/createFile').CreateFileTypeDocPlugin;
const LightTypeDocPlugin = require('./plugin/light').LightTypeDocPlugin;
// eslint-disable-next-line func-names
module.exports = function(PluginHost) {
const app = PluginHost.owner;
const options = app.options;
const renderer = app.application.renderer;
/*
* Expected array:
* interface Link {
* href: string;
* class?: string;
* id?: string;
* normal?: boolean;
* style?: string;
* target?: string;
* text?: string;
* }
*/
if (! options.getDeclaration('links')) {
options.addDeclaration({ name: 'links', type: ParameterType.Mixed });
}
if (! options.getDeclaration('linkDivider')) {
options.addDeclaration({
name: 'linkDivider',
type: ParameterType.String,
defaultValue: ' '
});
}
if (! options.getDeclaration('headerStart')) {
options.addDeclaration({ name: 'headerStart', type: ParameterType.String });
}
/*
* Expected object:
* interface ProjectName {
* link?: boolean;
* href?: string;
* name?: string;
* class?: string;
* style?: string;
* before?: string;
* after?: string;
* beforeLinks?: string;
* }
*/
if (! options.getDeclaration('projectName')) {
options.addDeclaration({
name: 'projectName',
type: ParameterType.Mixed,
defaultValue: {
link: true,
beforeLinks: ' '
}
});
}
if (! options.getDeclaration('style')) {
options.addDeclaration({ name: 'style', type: ParameterType.String });
}
if (! options.getDeclaration('toolbarBackground')) {
options.addDeclaration({ name: 'toolbarBackground', type: ParameterType.String });
}
if (! options.getDeclaration('script')) {
options.addDeclaration({ name: 'script', type: ParameterType.String });
}
if (! options.getDeclaration('showGoTop')) {
options.addDeclaration({
name: 'showGoTop',
type: ParameterType.Number,
defaultValue: 80
});
}
// Plugin options
/*
* Object or string.
* See makef.createFile, first parameter.
*/
if (! options.getDeclaration('createFile')) {
options.addDeclaration({ name: 'createFile', type: ParameterType.Mixed });
}
renderer.addComponent(CreateFilePlugin.ID, CreateFilePlugin);
renderer.addComponent(LightTypeDocPlugin.ID, LightTypeDocPlugin);
};