forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomDocNodeKind.ts
More file actions
59 lines (50 loc) · 2.27 KB
/
CustomDocNodeKind.ts
File metadata and controls
59 lines (50 loc) · 2.27 KB
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
import { TSDocConfiguration, DocNodeKind } from '@microsoft/tsdoc';
import { DocEmphasisSpan } from './DocEmphasisSpan';
import { DocHeading } from './DocHeading';
import { DocNoteBox } from './DocNoteBox';
import { DocTable } from './DocTable';
import { DocTableCell } from './DocTableCell';
import { DocTableRow } from './DocTableRow';
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* Identifies custom subclasses of {@link DocNode}.
*/
export const enum CustomDocNodeKind {
EmphasisSpan = 'EmphasisSpan',
Heading = 'Heading',
NoteBox = 'NoteBox',
Table = 'Table',
TableCell = 'TableCell',
TableRow = 'TableRow'
}
export class CustomDocNodes {
private static _configuration: TSDocConfiguration | undefined;
public static get configuration(): TSDocConfiguration {
if (CustomDocNodes._configuration === undefined) {
const configuration: TSDocConfiguration = new TSDocConfiguration();
configuration.docNodeManager.registerDocNodes('@micrososft/api-documenter', [
{ docNodeKind: CustomDocNodeKind.EmphasisSpan, constructor: DocEmphasisSpan },
{ docNodeKind: CustomDocNodeKind.Heading, constructor: DocHeading },
{ docNodeKind: CustomDocNodeKind.NoteBox, constructor: DocNoteBox },
{ docNodeKind: CustomDocNodeKind.Table, constructor: DocTable },
{ docNodeKind: CustomDocNodeKind.TableCell, constructor: DocTableCell },
{ docNodeKind: CustomDocNodeKind.TableRow, constructor: DocTableRow }
]);
configuration.docNodeManager.registerAllowableChildren(CustomDocNodeKind.EmphasisSpan, [
DocNodeKind.PlainText,
DocNodeKind.SoftBreak
]);
configuration.docNodeManager.registerAllowableChildren(DocNodeKind.Section, [
CustomDocNodeKind.Heading,
CustomDocNodeKind.NoteBox,
CustomDocNodeKind.Table
]);
configuration.docNodeManager.registerAllowableChildren(DocNodeKind.Paragraph, [
CustomDocNodeKind.EmphasisSpan
]);
CustomDocNodes._configuration = configuration;
}
return CustomDocNodes._configuration;
}
}